码迷,mamicode.com
首页 > Web开发 > 详细

Nginx自动跳转https

时间:2016-12-15 01:28:43      阅读:212      评论:0      收藏:0      [点我收藏+]

标签:nginx配置

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;

        }


     }


Nginx自动跳转https

标签:nginx配置

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

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!