LNMP nginx 配置SSL

生成openssl req -nodes -newkey rsa:2048 -keyout ssl.key -out ssl.csr
vi ssl.csr
lnmp vhost add
vi /usr/local/nginx/conf/vhost/xx.com.conf
server
{
listen 80;
listen 443;
server_name xxx.com;
index index.html index.htm index.php default.html default.htm default.php;
root /home/wwwroot/xxx;
ssl on;
ssl_certificate /root/ssl.crt;
ssl_certificate_key /root/ssl.key;
..........
}

service nginx restart
/etc/init.d/nginx restart
强制https,把listen 80;删除,在最后加
server
{
listen 80;
server_name xxx.com;
rewrite ^/(.*)$ https://xxx/$1 permanent;
}

 

 

debian重启nginx

sudo /etc/init.d/nginx restart

“`  配置完成php.ini后需要重启php5-fpm,使用命令

sudo /etc/init.d/php5-fpm restart
此条目发表在linux vps 日志分类目录。将固定链接加入收藏夹。

发表评论

电子邮件地址不会被公开。 必填项已用*标注

您可以使用这些HTML标签和属性: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>

Protected by WP Anti Spam