当前位置:首页 > 服务器技术 > nginx

Nginx自动跳转https

Nginx自动从http跳转到https

#vim nginx.conf

    server {

       listen 80;

       server_name www.test.com;

       charset utf-8;

       return     301 https://$server_name$request_uri;  #添加这行,即可以实现从http跳转到https

       access_log  logs/wwwuat.yaok.com.log  main;

       location / {

           rewrite ^/(.*)$ //$1 last;

       }


        location ^~ // {

                proxy_pass   http://127.0.0.1:8064;

                proxy_redirect off;

                proxy_set_header X-Real-IP $remote_addr;

                proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;

        }


     }


原文:http://536410.blog.51cto.com/526410/1882758


【说明】本文章由站长整理发布,文章内容不代表本站观点,如文中有侵权行为,请与本站客服联系(QQ:254677821)!