Jump to content

[HOW TO] Setup reverse proxy access to Emby on QNAP


viceversa

Recommended Posts

viceversa
I took on tackling this setup the other day and finally have reverse proxy working using the built in apache qnap web server.
 
Note that .lan is my local domain and "qnap" being a DNS entry pointing to the local IP of my QNAP. You will need to adjust this for your configuration accordingly.
 
I have Emby running on port 8096 and would have to access it via qnap.lan:8096
I would like to access it by simply typing "emby.lan" into the address bar.
 
I will walk through how to setup reverse proxy on QNAP with two different access methods. Sub-domain method (emby.lan) and suffix method (qnap.lan/emby)
 
We must first enable the QNAP web server virtual host feature via the GUI. Also, by default apache on QNAP does not load the proxy modules so we must edit the apache.conf to load them. Steps below:
 

1. Enable Virtual Host on your QNAP via the Web GUI.

     Control panel > Applications > Web Server > Virtual Host

     Check the Virtual Host check box then hit apply

 
2. SSH to your QNAP and navigate to /mnt/HDA_ROOT/.config/apache/
     Edit the apache.conf file and add the following line at the bottom of the file:
Include /etc/config/apache/extra/httpd-proxy.conf

     Save and exit the file.

 
3. Navigate to the "extra" directory: /mnt/HDA_ROOT/.config/apache/extra/
     Create a new file here named "httpd-proxy.conf"
     Add the following into this file:
LoadModule proxy_module modules/mod_proxy.so
LoadModule proxy_http_module modules/mod_proxy_http.so

Now we are setup to start configuring the reverse proxy. For this, we will be editing the file: /mnt/HDA_ROOT/.config/apache/extra/httpd-vhosts-user.conf

 

 

First, the sub-domain method. For this to work, you will need to add a DNS entry on your router which points to the qnap local IP when someone types "emby.lan" in the address bar. Resort to your router's user guides on how to set that up.

 

1. append to the following to httpd-vhosts-user.conf

<VirtualHost *:80>
        ServerName emby.lan
        ProxyPreserveHost On
        ProxyRequests Off
        ProxyVia Off
        <Location />
                #Order deny,allow
                ProxyPass http://127.0.0.1:8096/
                ProxyPassReverse http://127.0.0.1:8096/
        </Location>
        <Proxy *>
                #Order deny,allow
                Require all granted
        </Proxy>
</VirtualHost>
2. Now restart apache:
/etc/init.d/Qthttpd.sh restart
3. Test access by typing emby.lan/ into your browsers address bar!
 
 
Now the suffix method. No need to add custom DNS entry for this one.
 
1. Append the following to your httpd-vhosts-user.conf
Note that .lan is my local domain and "qnap" being a DNS entry pointing to the local IP of my QNAP. You will need to adjust this for your configuration accordingly.
<VirtualHost *:80>
        ServerName qnap.lan
        ProxyPreserveHost On
        ProxyRequests Off
        ProxyVia Off
        <Location /emby>
                #Order deny,allow
                ProxyPass http://127.0.0.1:8096/emby
                ProxyPassReverse http://127.0.0.1:8096/emby
        </Location>
        <Proxy *>
                #Order deny,allow
                Require all granted
        </Proxy>
</VirtualHost>
2. Now restart apache:
/etc/init.d/Qthttpd.sh restart
3. Test access by typing qnap.lan/emby into your browsers address bar!
 
 
Special note, when restarting apache, if you see the following appear "Recover apache confiugre" (yes that typo is correct) you've made an error in your configuration. QNAP will then disable the virtual host feature and it must be re-enabled in the GUI or by editing the apache.conf file.

 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...