V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
NGINX
NGINX Trac
3rd Party Modules
Security Advisories
CHANGES
OpenResty
ngx_lua
Tengine
在线学习资源
NGINX 开发从入门到精通
NGINX Modules
ngx_echo
dxhuii
V2EX  ›  NGINX

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

  •  
  •   dxhuii · 2016-11-30 16:46:06 +08:00 · 5101 次点击
    这是一个创建于 2693 天前的主题,其中的信息可能已经有所发展或是发生改变。
    有两个网站用这个配置,但另外一个好的,这个就提示重定向过多,帮忙看一下,配置如下:

    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;
    }
    }
    4 条回复    2016-12-01 10:42:44 +08:00
    eric6356
        1
    eric6356  
       2016-11-30 17:02:48 +08:00 via iPhone
    有可能被 dns 商重定向回来了?
    dxhuii
        2
    dxhuii  
    OP
       2016-11-30 17:32:18 +08:00
    @eric6356 修改了一下,把监听 80 放 443 上面就好了,好神奇。
    msg7086
        3
    msg7086  
       2016-12-01 01:12:36 +08:00
    会不会是因为你修改配置以后没有 restart nginx ?我记得遇到过有些类似的问题要 restart 解决。
    dxhuii
        4
    dxhuii  
    OP
       2016-12-01 10:42:44 +08:00
    @msg7086 每次修改都会重新 nginx nginx restart
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   3693 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 30ms · UTC 04:43 · PVG 12:43 · LAX 21:43 · JFK 00:43
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.