Skip to main content
Post date:
Wednesday, September 28, 2011

Sometimes you may find the need to shutdown a site for any reason an a specific server, basically the server that is listening to the web, so of course you will always want to keep that site(s) up and running while you perform whatever is needed on it, let's call it, 'external server', on a different environment, 'internal server'.
To do so you need to use an apache module called mod_proxy which enables a web server act as a router of traffic to another server, a tunnel.

- Enable mod_proxy and mod_proxy_http mod_proxy_html on external server
- create a virtual host on internal server pointing to internal server, ex:

<VirtualHost *:80>
    ServerName proxy.example.net
    ProxyRequests Off
    <Proxy *>
        Order deny,allow
        Allow from all
    </Proxy>

    ProxyPass / http://proxy.example.net/
    ProxyPassReverse / http://proxy.example.net/
    ProxyHTMLURLMap http://proxy.example.net /app1
    <Location />
        Order allow,deny
        Allow from all
        ProxyPassReverse /
#http://apache.webthing.com/mod_proxy_html/config.html
#On the above link version 3.0.1 of libapache2-mod-proxy-html
#does not use ProxyHTMLEnable instead uses ProxyHTMLInterp On|Off
#so this problem is coming.
#Ubuntu 10.04 by default uses
#libapache2-mod-proxy-html of version 3.0.1
#Changed the ProxyHTMLEnable to
#ProxyHTMLInterp
        ProxyHTMLInterp On
        ProxyHTMLURLMap  /      /app1/
        RequestHeader    unset  Accept-Encoding
    </Location>
</VirtualHost>

modify hosts file on you internal server and add the proper entry:

XXX.XXX.XXX.XXX          proxy.example.net

and finally on internal server you will have a normal virtual host for local.external.server.com

<VirtualHost *:80>
   DocumentRoot /var/www/proxy/www
   ServerName proxy.example.net
   <Directory /var/www/proxy/www>
       Options Indexes MultiViews FollowSymLinks
       AllowOverride All
       Order allow,deny
       Allow from all
   </Directory>
</VirtualHost>

Add new comment
The content of this field is kept private and will not be shown publicly.

Plain text

  • No HTML tags allowed.
  • Lines and paragraphs break automatically.
  • Web page addresses and email addresses turn into links automatically.

Related Blogs