使用 ssl 证书并配置 NGINX 的 HTTPS
1上一篇文章,把下载后得到的zip 文件:
( 两个文件,一个是.pem, 一个是 .key ) 放到 nginx的安装目录下( /etc/nginx/cert/ 中,在我的机器上)
2.修改对应的配置文件:
#https server { listen 443; server_name queentown.wenyc.cn; charset utf-8; ssl on; root html; index index.html index.htm; ssl_certificate cert/214192191870782.pem; ssl_certificate_key cert/214192191870782.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 html; index index.html index.htm; proxy_pass http://queen_town_web_servers; proxy_redirect default; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Real-IP $remote_addr; proxy_set_header Host $http_host; proxy_next_upstream http_502 http_504 error timeout invalid_header; }
4. 重启nginx . 访问 https://queentown.wenyc.cn 即可.