1

我无法弄清楚如何为以下内容配置 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>
4

0 回答 0