2009
02.27


I have a web application hosted in my local network, and it is not accessible from the internet as it is served behind a NAT. One of the way to make it accessible from the Internet is to configure reverse proxy in Apache web server at the gateway.

A reverse proxy server routes connection addressed to the internal server, and the client sees the reverse proxy server itself as the origin server.

To configure Apache to run as a reverse proxy server in SuSe, we must first make sure the required modules are loaded by Apache. The required modules are proxy and proxy_http, and the file to configure is /etc/sysconfig/apache2. Add the 2 modules among other modules in the APACHE_MODULES directive as the following example;

APACHE_MODULES="actions alias auth_basic authn_file authz_host authz_groupfile authz_default authz_user authn_dbm autoindex cgi dir env expires include log_config mime negotiation setenvif ssl suexec userdir php5 rewrite proxy proxy_http"

The second part is to configure the reverse proxy itself. Assuming the web application is located internally in http://192.168.0.10/myapp, and we would like people from the outside network to see it as http://www.domain.com/webapp, add the following lines in the /etc/apache2/default-server.conf

ProxyRequests Off

ProxyPass /webapp http://192.168.0.10/myapp
ProxyPassReverse /webapp  http://192.168.0.10/myapp

That’s all what it takes to configure the reverse proxy, and changes should take effect after the Apache web server is restarted.

 


No Comment.

Add Your Comment