【问题标题】:nginx redirects every http request to httpsnginx 将每个 http 请求重定向到 https
【发布时间】:2013-10-23 18:46:34
【问题描述】:

最后我切换到 nginx 网络服务器。但是每次我访问例如http://mywebsite.com时,它都会将我重定向到https://mywebsite.com。我的服务器块(虚拟主机)中没有任何 ssl 选项。这里是精简版(仅删除了帮助 cmets):

server {
        listen 80;
        root /usr/share/nginx/www/mywebsite/htdocs;
        index index.php index.html index.htm;
        server_name mywebsite.com;

        location / {
                try_files $uri $uri/ /index.html;
        }
        location ~ \.php$ {
                fastcgi_pass unix:/var/run/php5-fpm.sock;
                fastcgi_index index.php;
                fastcgi_param CONTEXT Staging;
                include fastcgi_params;
        }
}

我真的不知道我是否在正确的位置搜索错误?!

PS:PHP 回复我["SERVER_PROTOCOL"]=> string(8) "HTTP/1.1"

感谢您的建议!

【问题讨论】:

    标签: http redirect ssl https nginx


    【解决方案1】:

    知道了!我在我的/etc/nginx/fastcgi_params 中找到了我注释掉的fastcgi_param HTTPS $https; 行。现在,它工作正常。希望对其他人有所帮助。

    【讨论】:

      猜你喜欢
      • 2015-02-02
      • 2019-01-24
      • 2018-02-22
      • 1970-01-01
      • 1970-01-01
      • 2011-03-29
      • 2018-01-05
      • 1970-01-01
      • 2019-09-08
      相关资源
      最近更新 更多