【问题标题】:Infinite 301 redirects on 2 sites2 个站点上的无限 301 重定向
【发布时间】:2017-01-23 14:56:25
【问题描述】:

我有两个网站:

  1. http://forkandspoon.pl/-Worpress
  2. http://lunch.forkandspoon.pl/ - 自定义代码(旧的 Kohana 框架)

不确定发生了什么,但直到几天前一切正常。这些站点不再可访问。有无数个 301 重定向。
站点 1 - 奇怪的是,管理面板可以访问并且可以正常工作,但主网站不能。 Wordpress 已更新到最新版本,我确实更新了插件和主题,但我没有进行任何开发。
我禁用了所有插件,切换到不同的主题,删除了 .htaccess 文件(这是标准的,没有奇怪的代码)。没有任何帮助。
站点 2 - 我已经好几个月没有碰过这个站点了。

我浏览了这两个站点的代码,我将服务器上的代码与本地副本进行了比较。一切看起来都井井有条。
我在那台服务器上有 Apache 和 Nginx,配置根本没有改变。我在同一台服务器上托管了其他网站,它们不受影响。 Cloudflare 处理 DNS,我也检查了它,那里的一切看起来都很好。

这里会发生什么?我没主意了。有什么线索吗?

根据要求,这里是 Nginx conf:

server {
    listen 80;
    root /home/forkandspoon/forkandspoon.pl;
    index index.php index.html index.htm;
    server_name forkandspoon.pl www.forkandspoon.pl;

    location / {
        try_files $uri $uri/ /index.php;
    }

    location ~ \.php$ {
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $remote_addr;
        proxy_set_header Host $host;
        proxy_pass http://127.0.0.1:8080;
    }

    location ~ /\.ht {
        deny all;
    }
}

server {
    listen 80;
    root /home/forkandspoon/lunch.forkandspoon.pl;
    index index.php index.html index.htm;
    server_name lunch.forkandspoon.pl www.lunch.forkandspoon.pl;

    location / {
        try_files $uri $uri/ /index.php?$args;
    }

    location ~ \.php$ {
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $remote_addr;
        proxy_set_header Host $host;
        proxy_pass http://127.0.0.1:8080;
    }

    location ~ /\.ht {
        deny all;
    }
}

和阿帕奇

<VirtualHost *:8080>
    ServerAdmin myemail@domain.com
    DocumentRoot /home/forkandspoon/forkandspoon.pl/
    ServerName forkandspoon.pl
    ServerAlias www.forkandspoon.pl
    ErrorLog logs/forkandspoon.pl-error_log
    CustomLog logs/forkandspoon.pl-access_log common
    <Directory /home/forkandspoon/forkandspoon.pl>
        Options +Indexes FollowSymLinks +ExecCGI
        AllowOverride All
        Order Allow,Deny
        Allow from all
    </Directory>
</VirtualHost>

<VirtualHost *:8080>
    ServerAdmin myemail@domain.com
    DocumentRoot /home/forkandspoon/lunch.forkandspoon.pl/
    ServerName lunch.forkandspoon.pl
    ServerAlias www.lunch.forkandspoon.pl
    ErrorLog logs/lunch.forkandspoon.pl-error_log
    CustomLog logs/lunch.forkandspoon.pl-access_log common
    <Directory /home/forkandspoon/lunch.forkandspoon.pl>
        Options +Indexes FollowSymLinks +ExecCGI
        AllowOverride All
        Order Allow,Deny
        Allow from all
    </Directory>
</VirtualHost>

注意, 我还根据其中一个 cmets 禁用了 Cloudflare 代理。可能需要几分钟才能生效。

【问题讨论】:

  • 你试过关掉再打开吗?
  • 如果这个非常有用的评论是指重新启动 Apache 和 Nginx,那么是的,我做到了。
  • 看起来 CloudFlare 也在代理网站? IP 号码forkandspoon.pl 解析为 (104.28.1{8,9}.34) 归 CloudFlare 所有。
  • 我们真的需要查看 apache 和 nginx 配置文件
  • @DusanBajic 刚刚更新了主要问题

标签: wordpress redirect nginx


【解决方案1】:

事实证明这是一个已知问题https://wordpress.org/support/topic/45-causes-infinite-redirect-on-static-front-page/ 显然是在 Wordpress 4.5 中引入的,如果您的主页是静态页面,您将被无限重定向。
可以在上面的链接中找到解决方法。

感谢@DusanBajic 为我指明了正确的方向:)

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-10-20
    • 1970-01-01
    • 2011-02-07
    • 1970-01-01
    • 2017-08-02
    相关资源
    最近更新 更多