Configure PlexPy nginx Reverse Proxy on Linux

nginx-plexpy-reverse-proxyConfigure your PlexPy reverse proxy with nginx on Linux for convenient remote access. I’d recommend using a free dynamic DNS service like AfraidDNS (guide for automating), DuckDNS or No-IP so you can access PlexPy over the internet with an address like htpcguides.crabdance.com instead of your dynamic IP.

After completing this PlexPy reverse proxy tutorial you will be able to access PlexPy using your custom DNS address instead of http://IP:8181. This tutorial was tested on Debian and Ubuntu but the nginx virtual host should work on any Linux system (CentOS, Red Hat, Fedora, Arch etc). I will assume you followed the install PlexPy guide.

Usenet Provider
Backbone
Retention
Speed
Connections
VPN
Monthly
Annual
UsenetServer
UsenetServer
2265
Unlimited
20
Yes
$10
$95.40
Usenetlink
Cloudgate
2000
100 Mbit
30
No
$15
$140
Astraweb
Astraweb
2264
Unlimited
20
No
$7.50
$96.00
UsenetBucket
XS News
1100
40 Mbit
25
No
€4.95
€60.00
Frugal
Blocknews
600
Unlimited
60
No
$4.99
$50.00

Configure PlexPy nginx Reverse Proxy on Linux

Enabling a nginx reverse proxy for PlexPy requires setting a custom web root much like you do in Sonarr, CouchPotato, SickRage and other automation software. First we will prepare PlexPy to support the reverse proxy and then enable the correct nginx virtual host settings.

Prepare PlexPy for the reverse proxy

Stop your PlexPy system service

sudo service plexpy stop

Open your PlexPy configuration file so we can set the web root

sudo nano /opt/plexpy/config.ini

Find the [General] section (use Ctrl+W and enter General to speed things up) and change http_root to plexpy.

This http_root can be anything but must match the custom location in the nginx reverse proxy virtual host

[General]
graph_days = 30
http_root = /plexpy

Ctrl+X, Y and Enter to save

Restart the PlexPy service

sudo service plexpy restart

Enable the PlexPy nginx Reverse Proxy

Install nginx

sudo apt-get update
sudo apt-get install nginx -y

Unlink the default nginx virtual host

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

Create the Plex nginx reverse proxy virtual host

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

Paste this working PlexPy reverse proxy nginx virtual host. Make sure the location matches what you set as the http_prefix in PlexPy’s config.ini. If PlexPy listens on a port different than 8181 then change that too.

Change to match your dynamic DNS address (here htpcguides.crabdance.com) and local IP address (here 192.168.40.105).

If you already have a reverse proxy set up then only add the blue location block.

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

location /plexpy {
    proxy_pass http://127.0.0.1:8181;
    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

Link your Plex nginx virtual host into sites-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

If you got no errors then restart nginx to activate the PlexPy reverse proxy

sudo service nginx restart

Now you can access PlexPy via your reverse proxy with you dynamic DNS address or IP at http://ip.address/plexpy.
Please take a look at using https with your reverse proxy and consider using http authentication to prevent brute force attacks with this guide.