[How to] Integrate Apache2 Subsonic 4.1 Ubuntu server
Posted: Fri Nov 12, 2010 7:40 am
After 2 days of searching, trying things and not being pleased with the results I finally came up with this. It gets around the problem of external players not working properly.
I hope this helps
My Setup:
Ubuntu Server 8.04 LTS
Apache 2.2.14 configured not as localhost but as server01.mysite.dyndns-web.com (be careful, but take a look at
Subsonic 4.1 from subsonic-4.1.deb which does run as localhost:4040
(note: the .deb file install Jetty as the java server, not Tomcat. However this should make no difference when following this guide)
subsonic.sh SUBSONIC_CONTEXT=/subsonic
----purpose:
to change the browser URL from: http://mysite.somewhere.com:4040/subsonic
to: http://mysite.somewhere.com/subsonic
as if no port change happened. the end result is an internal proxy request the client never sees.
--------------install mod_rewrite and mod_proxy (all)
ssh into your server and become root
Note: most of the things you need to do here require you to be root.
rewrite and proxy were actually already included in my server install
-------------enable mod_rewrite and mod_proxy*
--------modify /etc/apache2/httpd.conf and add before any virtual hosts
Add these lines:
----------modify /ect/apache2/mods-enabled/proxy.conf
comment out:
Note: apparently this is not dangerous if ProxyRequest is never turned on.
Any attempt to use the proxy to masquerade as you by malicious scripting or hacking
would not succeed as all proxy requrests are forwarded only to the server/application you specify.
Make SURE ProxyRequest is OFF
If your server is not fully secured, proxy requests can be made to look like it's your server doing all kinds of bad stuff.
---------modify virtual host file /etc/apache2/sites-enabled/000 - default
First line after <Virtual host *:80> copy and paste the followingt:
Directly below that add:
(Note: you do NOT need ProxyPass, only ProxyPassReverse)
-------reload apache (not restart)
----- or
reboot the system
hope you had fun.
P.S. Let me know how you made out. And if I left something out.
I hope this helps
My Setup:
Ubuntu Server 8.04 LTS
Apache 2.2.14 configured not as localhost but as server01.mysite.dyndns-web.com (be careful, but take a look at
- Code: Select all
hostname --help
Subsonic 4.1 from subsonic-4.1.deb which does run as localhost:4040
(note: the .deb file install Jetty as the java server, not Tomcat. However this should make no difference when following this guide)
subsonic.sh SUBSONIC_CONTEXT=/subsonic
----purpose:
to change the browser URL from: http://mysite.somewhere.com:4040/subsonic
to: http://mysite.somewhere.com/subsonic
as if no port change happened. the end result is an internal proxy request the client never sees.
--------------install mod_rewrite and mod_proxy (all)
ssh into your server and become root
- Code: Select all
sudo su
Note: most of the things you need to do here require you to be root.
- Code: Select all
apt-get install libapache2-mod-proxy-html
rewrite and proxy were actually already included in my server install
-------------enable mod_rewrite and mod_proxy*
- Code: Select all
a2enmod rewrite
- Code: Select all
a2enmod proxy*
--------modify /etc/apache2/httpd.conf and add before any virtual hosts
- Code: Select all
nano /etc/apache2/httpd.conf
Add these lines:
- Code: Select all
RewriteEngine on
RewriteRule ^/subsonic(.*) http://mysite.dyndns-web.com:4040/subsonic$1 [P]
----------modify /ect/apache2/mods-enabled/proxy.conf
- Code: Select all
nano /ect/apache2/mods-enabled/proxy.conf
comment out:
- Code: Select all
#Deny from all
Note: apparently this is not dangerous if ProxyRequest is never turned on.
Any attempt to use the proxy to masquerade as you by malicious scripting or hacking
would not succeed as all proxy requrests are forwarded only to the server/application you specify.
Make SURE ProxyRequest is OFF
If your server is not fully secured, proxy requests can be made to look like it's your server doing all kinds of bad stuff.
---------modify virtual host file /etc/apache2/sites-enabled/000 - default
- Code: Select all
nano /etc/apache2/sites-enabled/000-default
First line after <Virtual host *:80> copy and paste the followingt:
- Code: Select all
# Without these 2 lines Apache2 does not pass on the Rewrite statements from httpd.conf
# to ANY Virtual Hosts. To enable Rewrite in ALL Virtual Hosts place this in ALL Virtual Host files.
RewriteEngine On
RewriteOptions Inherit
Directly below that add:
- Code: Select all
ProxyPassReverse /subsonic http://mysite.dyndns-web.com:4040/subsonic
(Note: you do NOT need ProxyPass, only ProxyPassReverse)
-------reload apache (not restart)
- Code: Select all
service apache2 force-reload
----- or
reboot the system
hope you had fun.
P.S. Let me know how you made out. And if I left something out.