nginx解决浏览器访问http自动转向https问题

2021-06-09 19:03

阅读:498

标签:head   share   .com   param   问题   shared   uri   ict   配置   

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问题

标签:head   share   .com   param   问题   shared   uri   ict   配置   

原文地址:http://www.cnblogs.com/xiewenming/p/7298893.html


评论


亲,登录后才可以留言!