In a previous post, I discussed the details required to set up Subsonic on Ubuntu 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.
The set up is fairly simple. On Ubuntu, it should be as simple as issuing this command (as root) to enable the proxy modules:
a2enmod proxy_http
Next I inserted the following into /etc/apache2/conf.d/subsonic.conf to make it available on all websites running on my server. If you only wanted it to be available for a single website, you could insert this into a site inside of /etc/apache2/sites-available/.
ProxyRequests Off
ProxyPreserveHost On
<Proxy *>
Order allow,deny
Allow from all
</Proxy>
ProxyPass /subsonic/ http://localhost:8180/subsonic/
ProxyPassReverse /subsonic/ http://localhost:8180/subsonic/
The configuration above says to not proxy all requests (not act as a forward proxy server). The ProxyPass and ProxyPassReverse set up the actual retrieval of data from Subsonic running on Tomcat. You need to replace the localhost and the port number with the specific items for your configuration. Finally, you need to reload the Apache configuration:
/etc/init.d/apache2 force-reload
Now Subsonic should be available on port 80 just like everything else running on your web server with Apache.
Are you still running Tomcat or just letting apache2 handle the web serving?
@Rick, This particular example is for Subsonic which requires Tomcat. Therefore, Tomcat handles serving Subsonic, and Apache handles forwarding the requests.
Hi,
I cannot setup the subsonic with port 80 access. Currently, the subsonic works well with 8080.
My steps after setup the subsonic standalone for my Ubuntu 8.04 LTS.
1. a2enmod proxy_http —> OK
2. create file /etc/apache2/conf.d/subsonic.conf (as it is missing by default)
3. Fill in the code
ProxyRequests Off
ProxyPreserveHost On
Order allow,deny
Allow from all
ProxyPass /subsonic/ http://192.168.0.115:8080/subsonic/
ProxyPassReverse /subsonic/ http://192.168.0.115:8080/subsonic/
4. Set the CONTEXT_PATH of the subsonic.sh
5. Restart the apache server
But I cannot fail. HTTP 404 showed.
@Gavin, What operating system are you running? My directions are specific to the Ubuntu/Debian varieties. If you are running something else, it’s possible that your subsonic.conf file is not being seen. You could try putting the configuration in another Apache configuration file that you know will be sourced.
Just a sanity check, you are able to get to the Subsonic server on port 8080 at the same time you are not able to get to it on port 80, correct?