Nginx Enable HTTPS

Source: Internet
Author: User

Adding a new server configuration in nginx.conf

Server {Listen443;        server_name www.some.com;        SSL on; Ssl_certificate Sslkey/SOME.COM.CRT; Ssl_certificate_key Sslkey/Some.com.key;        Ssl_session_timeout 5m; Ssl_protocols TLSv1 TLSv1.1TLSv1.2; Ssl_ciphers All:! Dh:! export:! rc4:+high:+medium:-low:!anull:!Enull;        Ssl_prefer_server_ciphers on; Location/{proxy_pass http://tomcat_www;} access_log Logs/www-Ssl.access.log Main; }

For 80-port access that requires a forced jump, use the

    Server {        listen       ;        server_name www.some.com;         / {            root   /var/www/html;            Index  index.html; # meta jump to HTTPS        }        access_log logs/www.access.log main;    }

index.html use

< HTML > <  http-equiv= "Refresh"  content= "0;url=https://www.some.com/">  </html>

Other jump Scenario One:

    Server {          listen  192.168.  1.111:          server_name test.com;                     ^ (. *) $  https://$host $ permanent;      }  

Programme II

Server {Listen192.168.1.11:443; #ssl端口 Listen192.168.1.11: the;          #用户习惯用http访问, plus 80, followed by 497 status code to let it automatically jump to 443 port server_name test.com; #为一个server {...}          Turn on SSL support SSL on; #指定PEM格式的证书文件 ssl_certificate/etc/nginx/Test.pem; #指定PEM格式的私钥文件 Ssl_certificate_key/etc/nginx/Test.key; #让http请求重定向到https请求 Error_page497Https//$host $uri? $args; }

Nginx Enable 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.