Apache – ProxyPass

I got a virtual machine which is installed with Apache. Normally, the virtual machine can only be accessed by the host computer. So how could i open the virtual machine service to the entire host network but not limited to the host computer?

This can be done by the Apache ProxyPass. Here is an example of setting up the ProxyPass

Assume we have the following initial configuration.

1. Apache/2.2.9 is installed in the host computer
2. A web application is running on the virtual machine
3. Host computer IP:
4. Virtual machine IP:
5. can only be accessed by the host computer

Our goal: Make the vmwebapp accessible by other machines in the host network

ProxyPass configuration @ host computer

1. Enable the apache modules for the ProxyPass (needs root privilege)
a2enmod proxy
a2enmod proxy_http

2. Create a new file at /etc/apache2/conf.d/proxypass.conf with the following setting

# ProxyPass configuration for vmwebapp
ProxyPass /vmwebapp
ProxyPassReverse /vmwebapp
<Location /vmwebapp>
        Options MultiViews Indexes SymLinksIfOwnerMatch IncludesNoExec
        Order deny,allow
        Allow from all

3. Restart the Apache
/etc/init.d/apache2 restart

You can now accessed the vmwebapp thru in the host network.

Done. =)


4 thoughts on “Apache – ProxyPass”

  1. This work *perfectly*. Simple and easy without over explanation. I needed this specifically because I have a windows virtual machine running a webapp (subsonic) while another virtual machine (ubuntu server) has apache with other web services. I didn’t want to have to specify the port of the other VM in the url, and this was the perfect fix. Thank you!


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.