nginx解决浏览器访问http自动转向https问题
Posted warren
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了nginx解决浏览器访问http自动转向https问题相关的知识,希望对你有一定的参考价值。
nginx配置文件如下:
server { listen 443 ssl http2; server_name zt.test.com; ssl on; ssl_protocols TLSv1 TLSv1.1 TLSv1.2; ssl_ciphers ‘AES128+EECDH:AES128+EDH:!aNULL‘; ssl_prefer_server_ciphers on; ssl_session_cache shared:SSL:10m; ssl_dhparam /etc/nginx/conf.d/ssl/dhparam.pem; ssl_certificate /etc/nginx/conf.d/ssl/test.com.crt; ssl_certificate_key /etc/nginx/conf.d/ssl/test.com.key; #把下面的注释掉就可以了 #add_header Strict-Transport-Security "max-age=63072000; includeSubdomains; preload"; access_log /var/log/nginx/zt.test.log main; set $web_url $host; location / { proxy_pass http://staticweb.server; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; set $domain default; } }
以上是关于nginx解决浏览器访问http自动转向https问题的主要内容,如果未能解决你的问题,请参考以下文章
nginx在Window平台http自动跳转https设置方法
Tomcat 8.5 配置https协议、http自动转向https(证书文件为 .pfx 格式)