我无法弄清楚如何为以下内容配置apache:
www.server.com/mstar应该通过乘客
但其他任何事情,例如: www.server.com/ www.server.com/index.hmtl 等等 应该通过mod代理。
所以,我需要检查一下是否有/ mstar作为路径的第一个组成部分,如果有,请通过乘客服务。但其他任何事情都应该通过mod_proxy。
类似的东西:
<VirtualHost *:80>
ServerName beta.server.com
DocumentRoot /home/ruby/webapps/m-star/current/public
<Location /mstar>
PassengerEnabled on
RailsBaseURI /mstar
# This relaxes Apache security settings.
AllowOverride all
# MultiViews must be turned off.
Options -MultiViews FollowSymLinks
Order allow,deny
Allow from all
</Location>
ProxyPass / http://beta.server.com:8890
ProxyPassReverse / http://beta.server.com:8890
<Location />
PassengerEnabled off
Order allow,deny
Allow from all
</Location>
</VirtualHost>
然而,这当然不起作用。
你能否给我一些关于在apache配置和乘客配置中应该注意什么的指示来实现这个目标?
我得到以下工作:
我按照我的说法完成了以下工作:
<VirtualHost *:80>
ServerName beta.server.com
ProxyRequests Off
<Proxy *>
Order deny,allow
Allow from all
</Proxy>
PassengerEnabled off
ProxyPassMatch ^/(?!mstar)(.*) http://beta.server.com:8890/$1
ProxyPassReverse / http://beta.server.com:8890
DocumentRoot /home/ruby/webapps/m-star/current/public
<Directory "/home/ruby/webapps/m-star/current/public">
PassengerEnabled on
RailsBaseURI /mstar
# This relaxes Apache security settings.
AllowOverride all
# MultiViews must be turned off.
Options -MultiViews FollowSymLinks
Order allow,deny
Allow from all
</Directory>
</VirtualHost>