一、安装nginx:
1 |
apt-get install nginx |
二、编辑默认配置文件:
1 |
/etc/nginx/sites-available/default |
三、配置文件里加上以下代码设置ssl:
1 2 3 4 5 6 7 8 9 |
listen 443 ssl; ssl_certificate /home/wwwroot/xxx.com.crt; ssl_certificate_key /home/wwwroot/xxx.com.key; ssl_protocols TLSv1 TLSv1.1 TLSv1.2; ssl_ciphers HIGH:!aNULL:!MD5; if ( $scheme = http ){ return 301 https://$server_name$request_uri; } |
四、修改绑定的域名:
1 |
server_name www.xxx.com; |