[LRUG] [OT:Apache] Mapping multiple domains to different controllers?

Matthew Rudy Jacobs matthewrudyjacobs at gmail.com
Tue Apr 14 07:34:40 PDT 2009


2009/4/14 Johnathan Loggie <me at johnno.com>:
>
> OK, this time I tested everything, and on my machine this will work by
> proxying from one site to the other, except for the index.html if present.
>
> <VirtualHost *:80>
>  ServerName somethingelse.local
>  DocumentRoot /home/matthew/myapp/public/other_domain
>
>  RewriteEngine On
>
>  # If there is an index.html use it in the usual way (no rewrite and stop)
>  RewriteCond %{DOCUMENT_ROOT}/index.html -f
>  RewriteRule ^/$ - [L]
>  RewriteRule ^/index.html - [L]
>
>  # Proxy assets to root of other site
>  RewriteRule ^/stylesheets(.*)$ http://mydomain.local/stylesheets$1 [P]
>  RewriteRule ^/javascripts(.*)$ http://mydomain.local/javascripts$1 [P]
>
>  # Proxy everything else to subdir of other site
>  RewriteRule ^(.*)$ http://mydomain.local/myapp$1 [P]
>
> </VirtualHost>

Cool,
thanks Jonathan.

Proxy was returning errors in the apache error logs,
it might be a simple error in my proxy.conf.

But I'm going to take all of your suggestions,
and try this again.

Will let you know what I come up with,
and write a blog post or something.

Cheers again.

Apache is quite fun,
but I found this gist -
http://gist.github.com/raw/46086/37fce75fa684bc55b8e691c55f856f9517d3be4e
that deals with having nginx proxy to Apache.

Might be a better solution all round.
>
>
> On 14/04/2009 12:32, "Johnathan Loggie" <me at johnno.com> wrote:
>
>>
>> Hi,
>>
>> I was wrong in what I said for using mod_rewrite in part 2 as this will
>> create a redirect, but funnily enough I tried your config out using only the
>> ProxyPass directive and mod proxy worked fine to proxy to the first vhost
>> from the second without any changes. The only problem was the url's to
>> assests like css and javascripts ended up incorrect but that is fixable.
>>
>> When you say mod proxy doesn't work, what do you mean exactly?
>>
>>
>> _______________________________________________
>> Chat mailing list
>> Chat at lists.lrug.org
>> http://lists.lrug.org/listinfo.cgi/chat-lrug.org
>>
>
>
> _______________________________________________
> Chat mailing list
> Chat at lists.lrug.org
> http://lists.lrug.org/listinfo.cgi/chat-lrug.org
>



More information about the Chat mailing list