我configuration了Apache来代理所有的请求到foo.bar.com,除了别名/ bazbar。 configuration的代理部分工作和代理传递部分工作,除了它作为纯文本文件服务于index.php。
我怎样才能让Apache正确地提供php文件? 这是我的configuration。
<VirtualHost *:80> ServerName foo.bar.com Alias /bazbar /var/www/bazbar ProxyPreserveHost On ProxyPass /bazbar ! <Location /bazbar> SetHandler None </Location> <Location /> Order allow,deny allow from all ProxyPass http://localhost:8080 ProxyPassReverse http://localhost:8080 </Location> </VirtualHost>
*注意我已经configuration正确的PHP,因为当我去http://localhost/somescript.php PHP呈现正常
看看<Location / bazbar>部分。 SetHandler None将禁用该位置的所有处理程序。 您需要删除该指令才能按预期工作。
如果您访问该机器上的http:// localhost:8080 / ,是否将index.php作为文本文件提供,还是在服务器上运行? 在代理的情况下,Apache会简单地把它得到的东西,并反馈给客户端。 我的第一眼会在那里。