Run sabnzbd+ behind Apache on Synology

Update

Since DSM 5 the paths are changed:

DSM 4:

  •  /usr/syno/etc/httpd-ssl-vhost.conf-user
  • /usr/syno/apache/conf/httpd.conf-user

DSM 5:

  • /etc/httpd/sites-enabled-user/httpd-ssl-vhost.conf-user
  • /etc/httpd/conf/httpd.conf-user

I’m an owner of a Synology DS211 and i have installed Sabnzbd+ on it, using this helpful package http://synoblog.superzebulon.org/2011/09/sabnzbd-0-6-9-1-spk/ (add it to your favorites, it’s a really nice site with more packages to download).

My  Synology is running on the latest 3.2 firmware.

After installation Sabnzbd+ is running on the following address http://private-diskstation-ip:8080, and i wanted to make it accessible in a secure way from the internet.
I want to be able to access the sabnzbd+ instance only from https and with a user/password prompt.

This could be done by configuring Apache. In fact i want to run sabnzbd+ behind Apache on Synology.

After a evening of searching and probing i finally got it working as I wanted:

The first thing to do if you haven’t already did it is to enable access to the Synology from the Command Line (http://forum.synology.com/wiki/index.php/Enabling_the_Command_Line_Interface)

Then from the prompt we edit the Apache configuration file with vi
(here are the basic commands: http://forum.synology.com/wiki/index.php/Basic_commands_for_the_Linux_vi_Editor):

For DSM 4:

vi /usr/syno/apache/conf/httpd.conf-user

For DSM 5:

vi /etc/httpd/conf/httpd.conf-user

We have to add the following directives at the end of the file:

LoadModule proxy_module modules/mod_proxy.so
LoadModule proxy_http_module modules/mod_proxy_http.so

Then we modify the virtual host file (i want to access Sabnzbd+ from a sub domain url, like subdomain.domain.com)

For DSM 4:

vi /usr/syno/etc/httpd-ssl-vhost.conf-user

For DSM 5:

vi /etc/httpd/sites-enabled-user/httpd-ssl-vhost.conf-user

And I added the following text:

ServerName subdomain.domain.com
<Location "/">
ProxyPass http://localhost:8080/sabnzbd/
ProxyPassReverse http://localhost:8080/sabnzbd/
AuthType Basic
AuthName "Restricted Files"
AuthUserFile /volume1/web/passwd/users.pw
Require valid-user
</Location>
SSLEngine on

Note that i already have created an authentication file (users.pw) which i’m using also for other protected host, if you don’t know how to create it follow this http://www.synology.com/support/faq_show.php?q_id=347&lang=enu

Then restart apache:

For DSM 4:

/usr/syno/etc/rc.d/S97apache-user.sh restart

For DSM 5:

httpd -k restart

Ready! Now i’m able to reach Sabnzbd+ running on my Synology from subdomain.domain.com in https and with user/pass prompt.

After doing that, be careful about editing vhosts with the Synology Gui, because modifying them from there will overwrite our custom modifications we have done in the /usr/syno/etc/httpd-ssl-vhost.conf-user file.

Don’t forget to open port TCP 443 on your router/modem and forward it to the internal ip of your Synology, and to create the subdomain in your DNS server/hosting provider.