WordPress,tomcat,apache2和nginx:在wordpress上redirect循环

我已经安装了一个网站的tomcat和另一个(WordPress的)的apache2。 这个问题发生在WordPress的网站。 有反向代理的nginx,这里是:

server { listen 80; root /var/www/html/; index index.php index.html index.htm; server_name test.example.com; 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:8081; } location ~ /\.ht { deny all; } } server { listen 80; server_name conf.example.com; location / { proxy_pass http://127.0.0.1:8080; } } server { listen 80 default_server; listen [::]:80 default_server ipv6only=on; root /usr/share/nginx/html; index index.html index.htm; # Make site accessible from http://localhost/ server_name batterykazakhstan.com; location / { # First attempt to serve request as file, then # as directory, then fall back to displaying a 404. try_files $uri $uri/ =404; # Uncomment to enable naxsi on this location # include /etc/nginx/naxsi.rules } } 

所以tomcat运作良好。 但Wordpress总是redirect到循环中的欢迎页面。 你能帮助解决这个问题吗? 我读了关于它,并试图通过把functions.phpbuild议在顶部的解决scheme:

 remove_filter('template_redirect', 'redirect_canonical'); 

但是这没有帮助..

EDIT1:

端口8081将会打开tomcat服务器并打开test.example.com这个WordPress站点

端口8080去conf.example.com和打开tomcat服务器的网站,工作正常。

编辑2:这里是Apache的configuration:

ServerAdmin webmaster @ localhost DocumentRoot / var / www / html

  ErrorLog ${APACHE_LOG_DIR}/error.log CustomLog ${APACHE_LOG_DIR}/access.log combined 

编辑3:

我只有两个.htaccess文件位于这里:

/var/www/html/wp-content/uploads/wp-clone/.htaccess

内容:

 <Files> Order allow,deny Deny from all Satisfy all </Files> 

还有一个在这里

/var/www/html/wp-content/plugins/akismet/.htaccess

内容:

 <IfModule !mod_authz_core.c> Order Deny,Allow Deny from all </IfModule> # Apache 2.4 <IfModule mod_authz_core.c> Require all denied </IfModule> # Akismet CSS and JS <FilesMatch "^(form\.js|akismet\.js|akismet\.css)$"> <IfModule !mod_authz_core.c> Allow from all </IfModule> <IfModule mod_authz_core.c> Require all granted </IfModule> </FilesMatch> # Akismet images <FilesMatch "^logo-full-2x\.png$"> <IfModule !mod_authz_core.c> Allow from all </IfModule> <IfModule mod_authz_core.c> Require all granted </IfModule> </FilesMatch> 

编辑4:

wp-admin工作正常,只有网站本身。 WordPress地址(URL)和网站地址(URL)都设置为http://test.example.com

让我在这里总结一下这个解决scheme。

在本示例中,我们的作者将构build一个典型的Nginx-Apache Web基础结构。 Nginx将被用作Web代理,将stream量redirect到不同的后端服务器。 这是一个简单的networking图,显示了这种关系。

网络图

作者希望将所有PHPstream量redirect到他的后端Apache Web服务器,但由于我们可能在php扩展后面有参数,所以以php结尾的匹配将失败。 有我们用来代替的位置块:

 location ~ \.php 

这将与任何URL .php关键字匹配,应该能够让作者执行后端PHP应用程序(例如WordPress)。 对于全新安装,我们可能还需要检查.htaccess文件是否位于WordPress的根文件夹。

参考链接: Nginx反向代理pipe理员指南 , WordPress htaccess文件 , htaccess WordPress安全