无限301重定向2个站点

时间:2016-09-15 14:20:09

标签: wordpress redirect nginx

我有两个网站:

  1. http://forkandspoon.pl/ - Worpress
  2. http://lunch.forkandspoon.pl/ - 自定义代码(旧Kohana框架)
  3. 不确定发生了什么,但几天前一切正常。这些网站不再可访问。有无数的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;
        }
    }
    

    和Apache

    <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>
    

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

1 个答案:

答案 0 :(得分:1)

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

感谢@DusanBajic指出我正确的方向:)

相关问题