A reverse proxy is a secure method of remotely accessing services on your home media server. Using nginx on any Linux based system (Ubuntu, Debian, Raspbian) you can access SickRage without having to remember the port number inside your home network. With a free dynamic dns address (Linux, Raspbian) you can manage SickRage at your friend's house at a custom address like htpcguides.crabdance.com/sickrage. It is very convenient and easy to set up once you know how, it will add that extra bit of awesomeness to your HTPC media server. This guide was tested on Raspbian but should work on any Linux based system. I assume you know what your IP address is and how to SSH in to your Linux box.

Usenet Provider Backbone Retention Speed Connections VPN Monthly Annual UsenetServer UsenetServer 3199 Unlimited 30 Yes $10 $95.40 Newshosting Newshosting 3199 Unlimited 30 Yes $10 $99 Frugal Frugal 3000 Unlimited 20 No $4.16 $50 Usenetlink Cloudgate 2000 100 Mbit 30 No $15 $140

Configure SickRage Reverse Proxy nginx Linux

Update your repositories

sudo apt-get update

Go add authentication for the SickRage WebUI if you haven't already

Go into your SickRage configuration at http://ip.address:8081 and click General and then the Interface tab

Scroll down until you see Web Interface and give yourself a HTTP username and password, click Save Changes

Restart SickRage as best practice to make sure it asks for authentication

Stop your SickRage service, if you followed my guides this command will stop the service

sudo service sickrage stop

Edit the sickrage configuration file

nano /opt/sickrage/config.ini

Change this line with the web root

web_root=""

to

web_root = "/sickrage"

There is a special setting to make reverse proxy work with SickRage, find this line

handle_reverse_proxy = 0

Change it to

handle_reverse_proxy = 1

Ctrl+X, Y and Enter to save and exit

Install nginx

sudo apt-get install nginx -y

Create a new nginx site

sudo nano /etc/nginx/sites-available/reverse

Add these lines, adjust your dynamic dns address (mine is htpcguides.crabdance.com) and local IP address (mine is 192.168.40.105. If you changed your default SickRage port change 127.0.0.1:8081 to reflect your port. If you gave your webroot a different name in the SickRage config.ini file then it will have to match the location /sickrage line.

server { listen 80; server_name htpcguides.crabdance.com 192.168.40.105 ; location /sickrage { proxy_pass http://127.0.0.1:8081; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; } }

Ctrl+X, Y and enter to save and exit

Disable the default nginx site

sudo unlink /etc/nginx/sites-enabled/default

Enable the reverse proxy site with sickrage enabled

sudo ln -s /etc/nginx/sites-available/reverse /etc/nginx/sites-enabled/reverse

Test nginx to make sure your configuration has the correct syntax

sudo nginx -t

Restart the nginx service if the test was successful

sudo service nginx restart

Start the SickRage service

sudo service sickrage start

You can now access SickRage locally within your home network at http://ip.address/sickrage.

If you have a dynamic DNS addresss you can access SickRage outside your home network at http://yourdns.address/sickrage

To access it outside the home network you will need to forward port 80 in your router to the machine hosting nginx.

If you get a 502 Bad gateway error it may be because you are on a Raspberry Pi or slow machine, give it a few minutes to load the SickRage web interface.

If you see this error, you have mistyped the location or webroot

Traceback (most recent call last): File "/opt/sickrage/tornado/web.py", line 1313, in _execute result = self.prepare() File "/opt/sickrage/tornado/web.py", line 2002, in prepare raise HTTPError(self._status_code) HTTPError: HTTP 404: Not Found

Enjoy your safe, secure nginx reverse proxy for SickRage. You can now close port 8081 on your router if you had it forwarded before.

If you want reverse proxy brute force protection using fail2ban see this guide.