How To Set Up Plex Behind an NGINX Reverse Proxy

Hello,

I had a question. I have a Plex server and an Ombi server for requesting content for it. I have the Ombi server pointed externally, so going to <domain.tld> takes you to it. How would it make it so <plex.domain.tld> directs to my specific Plex server inside my network? It’s hosted on a separate device from my Ombi webserver, which is on my Raspberry Pi running nginx, ddclient, and pihole.

EDIT: Additionally, if it helps any, I have Google Fiber and use their Network Box as my router. I already have domain.tld:32400 forwarded to my Plex server but I’d like to make it more friendly.

1 Like

Hi donut,

Thank you for your question! I’ve moved it to its own topic since I anticipate this could lead to a lengthier discussion.

You’ll need to do two things to “redirect” to Plex from an NGINX reverse proxy:

1) Set up a CNAME with your DNS.

CNAMEs, aka canonical name records, essentially say that a URL is an alias of another domain name. For example, I have a CNAME set up for www versions of my URL. Here is my www.engineerworkshop.com CNAME record in Google Domains:

In your case, you would replace www with “plex”. This will tell the web browser where to find your NGINX web server.

2) Set up your NGINX server as a reverse proxy for Plex.

The goal here is to proxy requests for “plex.domain.tld” directly to your Plex server. Therefore, you’ll want to use a generic boilerplate NGINX reverse proxy config. Something to the effect of:

upstream plex {
        server <PLEXserverInternalIPaddressHere>:32400;
        keepalive 4;
}

server {
        server_name plex.domain.tld;

        location / {
                proxy_set_header Host $host;
                proxy_set_header X-Forwarded-Proto $scheme;
                proxy_set_header X-Real-IP $remote_addr;
                proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
                proxy_pass https://plex;
        }
}

The above is a generic example and should at least get you started. Don’t forget to reload NGINX. You’ll also want to run Let’s Encrypt with your new subdomain.

Let me know how it turns out!

-TorqueWrench

Hello,

Sorry for the late response, been real busy with work.

That worked perfectly. Thank you so much!

  • donut
1 Like