Reverse Proxy Configuration in apache
Details required to set up Subsonic on centos Server. The problem with Subsonic is that it runs on Tomcat on a non-standard port. The rest of my web applications run in Apache on port 80. Therefore, it would be nice if instead of having to go to http://athos.zacintosh.com:8180/subsonic/, I could simply go to http://athos.zacintosh.com/subsonic/. The solution is called a reverse proxy. Reverse proxies can do things like load balance between multiple web servers or simply make resources on an internal web server available externally. In this case, I am using a reverse proxy to make a web application available on a different port available on the standard port 80.
1) Install the required rpm
Details required to set up Subsonic on centos Server. The problem with Subsonic is that it runs on Tomcat on a non-standard port. The rest of my web applications run in Apache on port 80. Therefore, it would be nice if instead of having to go to http://athos.zacintosh.com:8180/subsonic/, I could simply go to http://athos.zacintosh.com/subsonic/. The solution is called a reverse proxy. Reverse proxies can do things like load balance between multiple web servers or simply make resources on an internal web server available externally. In this case, I am using a reverse proxy to make a web application available on a different port available on the standard port 80.
1) Install the required rpm
# yum install httpd
2) Enable the proxy related modules in the httpd,conf file
# vi /etc/httpd/conf/httpd.conf
LoadModule proxy_module modules/mod_proxy.so
LoadModule proxy_http_module modules/mod_proxy_http.so
3) Add the below entries to the http configuration file.
# vi /etc/httpd/conf/httpd.conf
<IfModule mod_proxy.c>
ProxyRequests Off
<Proxy *>
Order deny,allow
Allow from all
</Proxy>
ProxyPreserveHost On
ProxyVia On
SSLProxyEngine on
ProxyPass /webdav http://ServerIP:8080/subsonic
ProxyPassReverse /webdav http://ServerIP:8080/subsonic
</IfModule>
Note: In
the above sample all the request comes to /subsonic URL redirect to the
another tomcat server. For example Apache server IP is 10.0.0.1 and the
tomcat server IP is 10.0.0.2, then the request like http://10.0.0.2:8080/subsonic will be redirect to http://10.0.0.2:8080/subsonic
4) To enable logging for the reverse proxy, add the below lines in the configuration file
# vi /etc/httpd/conf/httpd.conf
<IfModule mod_proxy.c>
CustomLog logs/access_proxy.log combined
ErrorLog logs/error_proxy.log
</IfModule>
5) Restart the httpd service
# /etc/init.d/httpd restart
No comments:
Post a Comment