Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Today I have two Apache Servers, Server A (192.168.0.5), Server B (192.168.0.10), both running at the same 80 port.

The actual request is from server a and the with my configuration it pass to server b (using mod_proxy), this is working.

Server A configuration:

NameVirtualHost *
<VirtualHost *>
    ServerName owncloud.mydomain.com

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

    ProxyPass / http://192.168.0.10:80/
    ProxyPassReverse / http://192.168.0.10:80/
    <Location />
        Order allow,deny
        Allow from all
    </Location>
</VirtualHost>

when I access to mycloud.mydomain.com the request is access using SERVER A but with the proxy it "proxies" to server B and then I see the content in server B, that's great but now my content is in mycloud.mydomain.com/owncloud, I don't know how to that url can be proxied and redirected using only mycloud.mydomain.com.

This is other configuration that I use in my server A for use the mod_proxy

 RewriteCond %{HTTP_HOST}   ^mycloud\.mydomain\.com$ [NC]
 RewriteRule   ^/(.*)$ http://mycloud.mydomain.com/$1  [P]

I want when a user access to mycloud.mydomain.com the mod_proxy redirect and proxy to mycloud.mydomain.com/owncloud.

How can I do this?


EDITED BY ME

My new configuration is:

RewriteCond %{HTTP_HOST}   ^owncloud\.mydomain\.com$ [NC]
RewriteRule ^/(.*)$ http://192.168.0.10:80/owncloud/$1 [P,L]
ProxyPassReverse / http://192.168.0.10:80/owncloud/

Im redirecting to owncloud.mydomain.com but the pages doesnt render well (like some css are not loading) but if i just add the /owncloud, everything works, but i dont want the user add the /owncloud. This is not working as expected, do im doing something wrong?

share|improve this question

1 Answer 1

Change thes proxying slightly using these lines:

 RewriteRule ^/(.*)$ http:///192.168.0.10:80/owncloud/$1 [P,L]
 ProxyPassReverse / http://192.168.0.10:80/owncloud/

These lines should replace these lines:

ProxyPass / http://192.168.0.10:80/
ProxyPassReverse / http://192.168.0.10:80/

The above lines say connections coming into / go to http:///192.168.0.10:80/owncloud/ (RewriteRule) and that connections going back out from the proxied server /owncloud/ get rewritten to / (ProxyPassReverse).

share|improve this answer
    
Hi, i edit the question adding your suggested configuration, but it didnt work for me, i hope you can still help me, thanks a lot. –  maxtorzito May 28 '13 at 14:33

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.