Configure Sabnzbd Reverse Proxy nginx Windows

nginx-sabnzbdA Reverse proxy is a cool way to remotely access your media server's web interfaces. When you are done with this guide you will be able to use your free dynamic DNS address (Windows Afraid DNS Guide) like htpcguides.crabdance.com/sabnzbd instead of htpcguides.crabdance.com:8080. This means fewer open ports on your router leaving you more secure while simultaneously having a convenient URL to access Sabnzbd behind an nginx reverse proxy. This guide was tested on Windows 8 but should work on an Windows 7 as well as Windows Server.

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 Sabnzbd Reverse Proxy Windows

Install nginx by downloading their official stable zip file currently version 1.6.2

Unpack it to c:\nginx-1.6.2 by dragging the folder to the C: drive

Open the configuration file in c:\nginx-1.6.2\conf\nginx.conf with Notepad or Notepad++

Find this section and change your server_name localhost to your dynamic dns address and your media server's local IP address

server {
        listen       80;
        server_name  localhost;

        #charset koi8-r;

        #access_log  logs/host.access.log  main;

Mine looks like this so I can access it locally and remotely

server {
        listen       80;
        server_name  htpcguides.crabdance.com 192.168.40.105;

        #charset koi8-r;

        #access_log  logs/host.access.log  main;

Underneath add these lines, change your server_name to your dynamic address

location /sabnzbd {
		proxy_pass http://127.0.0.1:8080;
		proxy_set_header Host $host;
		proxy_set_header X-Real-IP $remote_addr;
		proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
	}

The whole section will now look like this

server {
        listen       80;
        server_name  htpcguides.crabdance.com 192.168.40.105;

        #charset koi8-r;

        #access_log  logs/host.access.log  main;

	location /sabnzbd {
		proxy_pass http://127.0.0.1:8080;
		proxy_set_header Host $host;
		proxy_set_header X-Real-IP $remote_addr;
		proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
	}

Run a command prompt as an Administrator and enter these commands to start nginx

c:
cd c:\nginx-1.6.2
start nginx

See if you can access Sabnzbd at your server's IP address http://ip.address/sabnzbd

Let's make nginx start on boot

Create nginx.vbs in c:\nginx-1.6.2

Dim sh
Set sh = WScript.CreateObject("WScript.Shell")
sh.run "cmd /K CD C:\nginx-1.6.2\ & start nginx", 0

Create a shortcut and drag it to your startup folder

Reboot and it should all be working

If you ever edit your nginx.conf file you can reload the configuration with this command in the Windows command prompt

c:\nginx-1.6.2\nginx -s reload

If you want to access the reverse proxy outside your home network using your dynamic DNS address forward port 80 on your router