Apache Reverse Proxy可以排除某些文件类型吗?


Can Apache Reverse Proxy exclude certain file types?

我有一个Apache/Passenger组合服务Rails 3。x和服务于Rails 2的相同组合。x通过反向代理到Passenger Standalone。我这样做的原因是因为Rails 2。x使用比Apache/Passenger更老的Ruby版本。

然而,Rails 2中有一点php。x应用程序,乘客独立不支持。(乘客讨论群赖红丽确认)Hongli建议从反向代理中排除"php"位。

这可以做到吗?如果可以,如何做到?


编辑显示如何设置反向代理:

<VirtualHost *:80>
   ServerName gtt
   DocumentRoot /home/purvez/www/gtt/public
   RailsEnv development
   PassengerEnabled off
   ProxyPass / http://127.0.0.1:3000/
   ProxyPassReverse / http://127.0.0.1:3000/
</VirtualHost>

还有一个普通的网站是如何建立的:

<VirtualHost *:80>
   ServerName testapp
   DocumentRoot /home/purvez/www/testapp/public
   RailsEnv development
</VirtualHost>

您可以使用ProxyPassMatch进行排除,如下所示:

<VirtualHost *:80>
   ServerName gtt
   DocumentRoot /home/purvez/www/gtt/public
   RailsEnv development
   PassengerEnabled off
   ProxyPassMatch .*'.php$ !
   ProxyPass / http://127.0.0.1:3000/
   ProxyPassReverse / http://127.0.0.1:3000/
</VirtualHost>

注意,这将导致虚拟主机gtt中的所有'php位'从/home/purvez/www/gtt/public本地提供。

希望这能让你朝着正确的方向前进