1

Preamble:

I've configured a publicly accessible server with multiple virtual hosts. The requests for one virtual host need to be sent to a backend server. All the other requests need to be served locally.

Problem:

The request for ALL the virtual hosts are passed on to the IP address specified in the ProxyPass directive once the website which needs to be proxied is enabled. When I try to visit any of the other virtual hosts I get the webpage from the proxied website. When disabling the proxied website all other virtual hosts resume normal operation and are served locally.

Config:

The config I have on the publicly accessible server for the virtual hosts: (other virtual hosts are copies of the same config)

<VirtualHost *:80> ServerName www.mainsite.com ServerAlias mainsite.com ServerAdmin [email protected] DirectoryIndex index.php DocumentRoot /var/www/mainsite.com <Directory /> AllowOverride None </Directory> LogLevel info ErrorLog /var/log/mainsite.com_err.log CustomLog /var/log/mainsite.com_access.log combined </VirtualHost> 

The config I have on the publicly accessible server for the virtual host to be proxied:

<VirtualHost *:80> ServerName calendar.othersite.com ServerAdmin [email protected] ProxyRequests Off <Location /> ProxyPass http://192.168.0.1/ ProxyPassReverse http://192.168.0.1/ </Location> <Proxy> Order Allow,Deny Allow from all </Proxy> TransferLog /var/log/othersite.com_access.log ErrorLog /var/log/othersite.com_err.log CustomLog /var/log/othersite.com.log combined LogLevel debug </VirtualHost> 
5
  • You should be able to set up a ProxyPass/Reverse line for that specific site before the general one and have it go there, Apache should read them from first to last. Commented Sep 3, 2013 at 19:29
  • I'd try to add DocumentRoot /var/www/othersite.com. It can be empty directory of course. It's a wild guess though - I'm just not sure if <Location /> does not leak to other sites if it is for example /var/www for this vhost, inherited from main config. Commented Sep 3, 2013 at 19:41
  • @Tometzky Adding DocumentRoot did not solve the problem. Commented Sep 3, 2013 at 19:46
  • Another wild guess - remove ProxyPassReverse and add ProxyPreserveHost on instead. Commented Sep 3, 2013 at 19:53
  • @Tometzky removing ProxyPassReverse and adding ProxyPreseveHost did not solve the problem. Commented Sep 3, 2013 at 20:02

1 Answer 1

0

Try

sudo ln -s /etc/apache2/mods-available/proxy.load /etc/apache2/mods-enabled sudo ln -s /etc/apache2/mods-available/proxy_http.load /etc/apache2/mods-enabled sudo /etc/init.d/apache2 restart 

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.