May 13, 2009

Optimize Web server with 1 IP Public for many web server IP local By Tukang Nggame

If we have one Ip Public, but our web server more then one. How to configuration with apache webserver ? Tukang Nggame have tips. Follow example network topology :

wbsvr-1,wbsvr-2,etc -----main-server(public)--------client-browser

wbsvr-1 is a local webserver 1, example http://192.168.1.1/tukang-nggame/
wbsvr-2 is a local webserver 2, example http://192.168.1.2/tukangnggame/
main-server(public) is main web server, exh http://www.example.com

In Main Server use Apache web server and Isntall mod proxy-html. This command at console :

#apt-get install libapache2-mod-proxy-html

Enable that module (make link module) with command at console :
 
 #ln -s /etc/apache2/mods-available/proxy_http.load /etc/apache2/mods-enabled/proxy_html.load
 #ln -s /etc/apache2/mods-available/proxy_http.conf /etc/apache2/mods-enabled/proxy_html.conf

Edit configuration /etc/apache2/apache2.conf (main server)


Order Deny,Allow
Allow from All
ProxyPass http://192.168.1.1/tukang-nggame/
ProxyPassReverse   http://192.168.1.1/tukang-nggame/
< /Location >


Order Deny,Allow
Allow from All
ProxyPass http://192.168.1.2/tukangnggame/
ProxyPassReverse   http://192.168.1.2/tukangnggame/
< /Location >

Restart apache server in main server with command at console.
 #/etc/init.d/apache2 restart

 Then browse from client-browser
 http://192.168.1.1/tukang-nggame/ with url http://www.example.com/tukang-nggame/
 http://192.168.1.1/tukangnggame/ with url http://www.example.com/tukangnggame/

Don't forget last url with slash (/).

Bingo !

Click Here!