Nginx Configuration HTTPS

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.