nginx 强制 https 浏览器总是提醒重定向过多不能正常访问网页

2016-11-30 16:46:06 +08:00
 dxhuii
有两个网站用这个配置,但另外一个好的,这个就提示重定向过多,帮忙看一下,配置如下:

server{
listen 443 ssl;
server_name zhidao.xxxx.com;
index index.html index.htm index.php default.html default.htm default.php;
root /mnt/xxxx/zhidao;

ssl_certificate /mnt/xxxx/zhidao/zhidao.chained.crt;
ssl_certificate_key /mnt/xxxx/zhidao/zhidao.ikanfan.com.key;
ssl_ciphers "EECDH+AESGCM:EDH+AESGCM:AES256+EECDH:AES256+EDH";
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_prefer_server_ciphers on;
ssl_session_cache shared:SSL:10m;

include zhidao.conf;
#error_page 404 /404.html;
location ~ [^/]\.php(/|$)
{
# comment try_files $uri =404; to enable pathinfo
try_files $uri =404;
fastcgi_pass unix:/tmp/php-cgi.sock;
fastcgi_index index.php;
include fastcgi.conf;
#include pathinfo.conf;
}

location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$
{
expires 30d;
}

location ~ .*\.(js|css)?$
{
expires 12h;
}

access_log off;
}
server
{
listen 80;
server_name zhidao.xxxx.com;
location /.well-known/ {
add_header Content-Type 'text/plain;';
root /mnt/xxxx/zhidao;
}
location / {
return 301 https://zhidao.xxxx.com$request_uri;
}
}
5112 次点击
所在节点    NGINX
4 条回复
eric6356
2016-11-30 17:02:48 +08:00
有可能被 dns 商重定向回来了?
dxhuii
2016-11-30 17:32:18 +08:00
@eric6356 修改了一下,把监听 80 放 443 上面就好了,好神奇。
msg7086
2016-12-01 01:12:36 +08:00
会不会是因为你修改配置以后没有 restart nginx ?我记得遇到过有些类似的问题要 restart 解决。
dxhuii
2016-12-01 10:42:44 +08:00
@msg7086 每次修改都会重新 nginx nginx restart

这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。

https://www.v2ex.com/t/324379

V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。

V2EX is a community of developers, designers and creative people.

© 2021 V2EX