在阿里雲上申請一個免費的ssl證書,須要在服務器中配置一下。html
server { listen 443; server_name localhost; ssl on; root html; index index.html index.htm; ssl_certificate /etc/nginx/cert/214801954620462.pem; ssl_certificate_key /etc/nginx/cert/214801954620462.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 /usr/share/nginx/html; index index.html index.htm; } }
注意:這裏的名稱要保持一致nginx
nginx -t
nginx -s reload