Reverse Proxies are an elegant and convenient method to remotely manage your media server's services. nginx can forward requests to your uTorrent web interface on your HTPC. 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/htpc instead of htpcguides.crabdance.com:8085.
You will have less open ports on your router making you more secure while simultaneously having a convenient URL to access uTorrent behind an nginx reverse proxy. This guide was tested on Windows 8 but should work on Windows 7 and Windows Server editions too (though use an nssm service). This guide requires you have enabled the uTorrent WebUI (guide here). I also recommend using a free Dynamic DNS address (guide) but it is not necessary.
Torrent safely using Private Internet Access or PureVPN (uTorrent configuration guide)
VPN Service | ||||
---|---|---|---|---|
Private Internet Access | ($3.33 / month) | |||
Pure VPN | ($4.91 / month) | |||
IPVanish | ($6.41 / month) |
Configure uTorrent Reverse Proxy nginx Windows
Install nginx by downloading their official stable zip file currently version 1.8.0
Unpack it to c:\nginx-1.8.0 by dragging the folder to the C: drive
Open the configuration file in c:\nginx-1.8.0\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 uTorrent 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 port (here 7070) may be different depending on the port you set for the uTorrent WebUI.
/gui is fixed in the uTorrent javascript files which you will have to edit if you want a different path or play with nginx rewrites.
location /gui {
proxy_pass http://127.0.0.1:7070/gui;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
If you want to use a custom location like /utorrent for your uTorrent nginx reverse proxy add the red lines too
location /gui {
proxy_pass http://127.0.0.1:7070/gui;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
location /utorrent {
proxy_pass http://127.0.0.1/gui;
}
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 /gui {
proxy_pass http://127.0.0.1:7070;
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.8.0
start nginx
See if you can access uTorrent at your server's IP address http://ip.address/gui
Let's make nginx start on boot
Create nginx.vbs in c:\nginx-1.8.0
Dim sh
Set sh = WScript.CreateObject("WScript.Shell")
sh.run "cmd /K CD C:\nginx-1.8.0\ & 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.8.0\nginx -s reload
If you want to access the reverse proxy outside your home network using your dynamic DNS address forward port 80 from your router to your Windows box running nginx.
Enjoy your uTorrent reverse proxy with nginx.