Apache反向代理服务错误的内容

我在一个HTTP守护进程前面有一个Apache Proxy设置,它为Sinatra Web应用程序提供下列指令(这很好用)

ProxyPass / http://ip-ad-dr-ess:8080/ ProxyPassReverse / http://ip-ad-dr-ess:8080/ 

这使我可以浏览http://example.com,并从守护程序Web服务器提供内容。 我想包括一个wordpress博客作为主站点的子目录。

 http://example.com <- Sinatra http://example.com/blog <- WordPress 

这是整个configuration部分

 <IfModule mod_proxy_http.c> LogLevel debug ProxyRequests Off ProxyPass /blog http://blog.example.com:80/ ProxyPassReverse /blog http://blog.example.com:80/ ProxyPass / http://ip-ad-dr-ess:8080/ ProxyPassReverse / http://ip-ad-dr-ess:8080/ <Location /> RequestHeader set X-Forwarded-Protocol http </Location> <Location /blog> RequestHeader set X-Forwarded-Protocol http </Location> ProxyPreserveHost on ProxyErrorOverride Off </IfModule> 

我遇到的问题是,当我导航到http://example.com/blog我从http://example.com提供的内容,而不是从WordPress的。

作为testing,在上面的configuration中,我用http://www.google.com:80/replace了http://blog.example.com:80/ ,当我导航到http://example.com/blog时我只是redirect到谷歌的网站(与地址栏中的url)这不是我所期望的行为。

任何想法如何解决或可能进一步debugging这个问题,为什么wordpress内容不服务?

谢谢

更新blog.exmaple.com摘录

 <VirtualHost ip-ad-dr-ess:80> ServerAdmin [email protected] DocumentRoot /home/path/blog.example.com ServerName www.blog.example.com ServerAlias blog.example.com DirectoryIndex index.html index.shtml index.htm Index.html Index.htm Index.shtml$ ErrorLog /home/path/logs/blog.example.com/http.20187367/error.log Alias /stats /home/path/logs/blog.example.com/http.20187367/html <Directory /home/path/logs/blog.example.com/http.20187367/html> AllowOverride AuthConfig FileInfo Indexes Limit Options=ExecCGI,Includes,Indexes$ </Directory> Alias /doc/analog /usr/share/analog RewriteEngine on RewriteCond %{HTTP_HOST} =www.blog.example.com [NC] RewriteRule ^(.*) http://blog.example.com$1 [R=301,NE] </VirtualHost> 

你应该尝试添加一个尾部的斜线“/ blog”这样的path

 ProxyPass /blog/ http://blog.example.com/ ProxyPassReverse /blog/ http://blog.example.com/ 

我能解决这个问题。 根本原因是我在同一个ip和同一个端口上从一个虚拟主机到另一个虚拟主机设置代理。

我将blog.example.com更改为在不同的端口上侦听,更新了http://example.com的代理值,从而解决了问题