You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by Robert Decker <co...@gmail.com> on 2012/06/27 15:29:25 UTC

[users@httpd] Confusing apache configuration

Hello. I'm having trouble figuring out how to configure apache for the
following:

www.server.com/mstar should go through mod_passenger

but anything else, such as:
www.server.com/
www.server.com/index.hmtl
etc
should go through mod_proxy.

So, I would need something to check if it has /mstar as the first
component of the path and if so, have it served through passenger. But
anything else should go through mod_proxy.

something like:

<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>

However, this of course is not working.

Can you give me some pointers on what to look at in the apache
configurations to accomplish this?

-- 
-robert

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] Confusing apache configuration

Posted by Robert Decker <co...@gmail.com>.
Thanks! That was the clue I needed. The following is working for me:

<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>



On Wed, Jun 27, 2012 at 3:51 PM, Daniel Gruno <ru...@cord.dk> wrote:
> On 06/27/2012 03:29 PM, Robert Decker wrote:
>> Hello. I'm having trouble figuring out how to configure apache for the
>> following:
>>
>> www.server.com/mstar should go through mod_passenger
>>
>> but anything else, such as:
>> www.server.com/
>> www.server.com/index.hmtl
>> etc
>> should go through mod_proxy.
>>
>> So, I would need something to check if it has /mstar as the first
>> component of the path and if so, have it served through passenger. But
>> anything else should go through mod_proxy.
>>
>> something like:
>>
>> <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>
>>
>> However, this of course is not working.
>>
>> Can you give me some pointers on what to look at in the apache
>> configurations to accomplish this?
>>
> What you might find useful is to use ProxyPassMatch with a negative
> lookahead. Try replacing your ProxyPass directive with:
>
> ProxyPassMatch ^/(?!mstar)(.*) http://beta.server.com:8890/$1
>
> This will effectively proxy only URIs that do not start with /mstar.
>
> With regards,
> Daniel.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
> For additional commands, e-mail: users-help@httpd.apache.org
>



-- 
-robert

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] Confusing apache configuration

Posted by Daniel Gruno <ru...@cord.dk>.
On 06/27/2012 03:29 PM, Robert Decker wrote:
> Hello. I'm having trouble figuring out how to configure apache for the
> following:
> 
> www.server.com/mstar should go through mod_passenger
> 
> but anything else, such as:
> www.server.com/
> www.server.com/index.hmtl
> etc
> should go through mod_proxy.
> 
> So, I would need something to check if it has /mstar as the first
> component of the path and if so, have it served through passenger. But
> anything else should go through mod_proxy.
> 
> something like:
> 
> <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>
> 
> However, this of course is not working.
> 
> Can you give me some pointers on what to look at in the apache
> configurations to accomplish this?
> 
What you might find useful is to use ProxyPassMatch with a negative
lookahead. Try replacing your ProxyPass directive with:

ProxyPassMatch ^/(?!mstar)(.*) http://beta.server.com:8890/$1

This will effectively proxy only URIs that do not start with /mstar.

With regards,
Daniel.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org