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