【发布时间】:2016-09-06 02:23:22
【问题描述】:
我在 Apache2 上托管了一个 wordpress,前面是 Nginx。
<WORLD> ===> <NGINX PROXY> --> APACHE/DOCKER/STATIC WEBSITE etc...
我的 wordpress 代理的 nginx 配置是:
server {
server_name dev-www.example.com;
location / {
proxy_pass http://127.0.0.1:13400;
}
}
我的 apache 配置:
Listen 13400
<VirtualHost 127.0.0.1:13400>
CustomLog /var/log/httpd/sites/dev-www/access_log combined
ErrorLog /var/log/httpd/sites/dev-www/error_log
DirectoryIndex index.php
DocumentRoot /var/www/sites/example.com/dev-www
RewriteEngine On
<Directory /var/www/sites/example.com/dev-www/>
Options Indexes FollowSymLinks
AllowOverride all
</Directory>
</VirtualHost>
还有wordpress.htaccess:
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . index.php [L]
</IfModule>
# END WordPress
问题是当我继续 dev-www.example.com/foobar.php 时,我被重定向到 127.0.0.1/foobar.php。我知道它来自nginx 配置127.0.0.1 弹出放置如何修复它?
我尝试代理传递给dev-www.example.com:13400,但我得到了一个无限循环:
[2016 年 5 月 10 日星期二 23:44:45.001680] [core:error] [pid 1096] [client 127.0.0.1:54887] AH00124:由于可能的配置错误,请求超出了 10 个内部重定向的限制。采用 'LimitInternalRecursion' 必要时增加限制。采用 'LogLevel debug' 获取回溯。,referer: http://dev-www.example.com/
注意:http://dev-www.example.com 或 http://dev-www.example.com/index.php 没有问题
谢谢。
note2:如果我将 nginx 配置更改为 localhost:13400,那么我将被重定向到 localhost/login-3。它看起来像 .htaccess 重定向到 ServName,它是 127.0.0.1
【问题讨论】:
-
“当我继续使用 dev-www.example.com/foobar.php 时,我被重定向”是指当您将这个 URL 直接输入到浏览器的地址栏中?
-
是的,或者点击链接,同样的行为。 dev-www.example.com/login-3 将我重定向到 127.0.0.1/login-3
-
如果我将 nginx 配置更改为
localhost:13400,那么我将被重定向到localhost/login-3。它看起来像.htaccess重定向到 ServName 并且它是127.0.0.1 -
你在命令行上试过
curl -D - dev-www.example.com吗? -
您的
.htaccess中没有重定向。 Wordpress 必须这样做。
标签: php wordpress apache .htaccess nginx