最后我切换到 nginx 网络服务器。但是每次我访问例如 http://mywebsite.com
时,它都会将我重定向到 https://mywebsite.com
。我的服务器 block (vhost) 中没有任何 ssl 选项。这是一个精简版(只删除了帮助评论):
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"
多谢指教!
最佳答案
明白了!我在我的 /etc/nginx/fastcgi_params
中找到了我注释掉的 fastcgi_param HTTPS $https;
行。现在,它工作正常。希望对其他人有所帮助。
关于http - nginx 将每个 http 请求重定向到 https,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19549915/