证书申请
申请免费证书(阿里云吧). 然后下载。
在nginx目录下创建文件夹: /etc/nginx/conf.d/cert
将证书复制到此文件夹.
然后修改conf.d下的wiki.conf 配置文件.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
| server { listen 80; server_name wiki.quartz.ren; access_log /var/log/wiki.access.log; rewrite ^(.*)$ https://$host$1 permanent; error_page 404 /404.html; error_page 500 502 503 504 /50x.html; location = /50x.html { root html; } } server { listen 443 ssl; server_name wiki.quartz.ren; root html; index index.html index.htm; ssl_certificate conf.d/cert/3714771_wiki.quartz.ren.pem; ssl_certificate_key conf.d/cert/3714771_wiki.quartz.ren.key; ssl_session_timeout 5m; ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:ECDHE:ECDH:AES:HIGH:!NULL:!aNULL:!MD5:!ADH:!RC4; ssl_protocols TLSv1 TLSv1.1 TLSv1.2; ssl_prefer_server_ciphers on; location / { root /data/blog/wiki/public_deploy/; index index.html index.htm; } }
|
nginx证书配置