Apache Confiver与Passenger和ProxyPassMatch正则表达式适用于多个Ruby on Rails应用程序

时间:2012-10-11 15:03:03

标签: ruby-on-rails regex apache passenger proxypass

我有Apache服务的Apache Sling应用程序。但是,当有人访问同一个网址但在网址前面有/ mstarfb时,他们会通过Passenger通过Ruby on Rails应用程序获得服务。我想添加第二个由/ i-metaphor提供的Ruby on Rails应用程序。

这是我现在拥有和工作的东西:

<VirtualHost *:80>
    ServerName beta.example.com

    ProxyRequests Off
    <Proxy *>
        Order deny,allow
        Allow from all
    </Proxy>

PassengerEnabled off

ProxyPassMatch ^/(?!mstarfb)(.*) http://127.0.0.1:8890/$1   
ProxyPassReverse / http://beta.example.com:8890


DocumentRoot /home/ruby/webapps/m-star-fb/current/public
    <Directory "/home/ruby/webapps/m-star-fb/current/public">
        PassengerEnabled on
        RailsBaseURI /mstarfb
        # This relaxes Apache security settings.
        AllowOverride all
        # MultiViews must be turned off.
        Options -MultiViews FollowSymLinks
        Order allow,deny
        Allow from all
    </Directory>

第一个问题是正则表达式应该如何看待。我已经尝试了各种我能想到的组合,但是我不确定它们是否因为正则表达式错误或者因为配置的其余部分是错误而失败了。像Somtehing一样:

ProxyPassMatch ^/(?!mstarfb|?!i-metaphor)(.*) http://127.0.0.1:8890/$1

第二个问题是我如何组织虚拟主机?在代理行后我尝试过:

    DocumentRoot /home/ruby/webapps
    <Directory "/home/ruby/webapps/m-star-fb/current/public">
    PassengerEnabled on
    RailsBaseURI /mstarfb
        AllowOverride all
        Options -MultiViews FollowSymLinks
        Order allow,deny
        Allow from all
    </Directory>

但它打破了我的第一个应用程序...我还没有尝试添加第二个应用程序。

0 个答案:

没有答案