1. Certificate of Application:
Https://console.qcloud.com/ssl?utm_source=yingyongbao&utm_medium=ssl&utm_campaign=qcloud
2. Import the certificate into the server, either XFTP or Filezilla:
3. Modify nginx, My nginx is located in/etc/nginx/:
Nginx comes with SSL configuration, delete the comments, modify the certificate location is Good.
80 Port Configuration:
Server {listen thedefault_server; Listen [::]: thedefault_server; server_name _; #root/usr/share/nginx/html;
#注意添加下面这行代码, for redirecting rewrite^ (. *) https://$server _name$1 permanent;# Load configuration Files forthe Default Server Block. Include/etc/nginx/default.d/*. conf; location/{} Error_page 404/404.html; Location =/40x.html {} Error_page 502 503 504/50x.html; Location =/50x.html {}}
443 Port Settings:
Server {listen443SSL HTTP2 default_server; Listen [::]:443SSL HTTP2 default_server; server_name _; Root/usr/share/nginx/html;# ssl_certificate"/ETC/PKI/NGINX/SERVER.CRT"; # Ssl_certificate_key"/etc/pki/nginx/private/server.key"; Ssl_certificate/etc/nginx/conf.d/1_www.bincoding.cn_bundle.crt; Ssl_certificate_key/etc/nginx/conf.d/2_www.bincoding.cn.key; Ssl_session_cache shared:ssl:1m; Ssl_session_timeout 10m; Ssl_ciphers High:!anull:!MD5; Ssl_prefer_server_ciphers on; # Load configuration Files forthe Default Server Block. Include/etc/nginx/default.d/*. conf; location/{} Error_page 404/404.html; Location =/40x.html {} Error_page 502 503 504/50x.html; Location =/50x.html {}}
finally, Remember to restart Nginx:service nginx restart
Reference:
Nginx Configuration HTTPS https://www.v2ex.com/t/309382
Common server Configuration https://mozilla.github.io/server-side-tls/ssl-config-generator/
Nginx Configuration HTTPS