My situation is as follows:
Telenet cable internet (modem only) – Fritzbox router – Switch – Synology NAS
I wanted to be able to reach the Subsonic and the Plex daemon running on my Synology NAS.
So I decided to setup 2 subdomains and with a reverse proxy (on apache) reach the daemons.
I have a home.domain.com subdomain, which points to my dynamic IP address (my fritzbox router updates it when the IP changes).
I created 2 extra subdomains (each with a cname to home.domain.com):
music.home.domain.com (this one has to point to Subsonic)
movies.home.domain.com (this one has to point to Plex)
In DSM 5.2 (the Synology web interface) I activated WebStation in the control pannel. I also activated ssl (with a self signed certificate -> creating a good one will be my next step (and blog post)).
I logged in (ssh with root) to my Synology and changed the following:
$cd /etc/httpd/sites-enabled-user
$nano httpd-ssl-vhost.conf-user
Put the following in the httpd-ssl-vhost.conf-user file (change the ServerName to yours):
<VirtualHost *:443>
ServerName music.home.domain.com
SSLEngine On
SSLProxyEngine On
ProxyRequests Off
ProxyVia Off
<Proxy *>
Order deny,allow
Allow from all
</Proxy>
ProxyPass / http://192.168.0.100:4040/
ProxyPassReverse / http://192.168.0.100:4040/
</VirtualHost>
<VirtualHost *:443>
ServerName movies.home.domain.com
SSLEngine On
SSLProxyEngine On
ProxyRequests Off
ProxyVia Off
<Proxy *>
Order deny,allow
Allow from all
</Proxy>
ProxyPass / http://192.168.0.100:32400/
ProxyPassReverse / http://192.168.0.100:32400/
</VirtualHost>
On the Fritzbox router, forward port 443 (ssl) to port 443 on the Synology (192.168.0.100 in my case).
Restart Apache
$httpd -k restart
Now you can reach Subsonic via https://music.home.domain.com
You can reach Plex via https://movies.home.domain.com/web/ (notice the /web/ in the end!)
Adding
RewriteEngine on
RewriteCond %{REQUEST_URI} !^/web
RewriteCond %{HTTP:X-Plex-Device} ^$
RewriteRule ^/$ /web/$1 [R,L]
just before the closing of the tag, should help you to get rid of the /web/ and reach Plex on https://movies.home.domain.com
Verder te bekijken: https://gist.github.com/HazCod/3ef10a15f52c171a7839