Plex Reverse Proxy Setup for Direct Access

The following is a quick guide to using nginx and with a custom domain name to allow direct access to your plex instance and not have to rely on Plex Relay which limits bandwidth to 2Mbps.
Dynamic DNS Service
Use DynuDNS to setup your chosen domain e.g., myservers.com, do this before anything else - you don't need to use DynuDNS, but it's free and works great. I use nginx proxy manager, as my reverse proxy, to map ports to the appropriate services/servers on my network. In this case Plex. The only ports to open on your firewall should be 80 and 443, and point these to the internal nginx proxy manager IP. These ports then assist in redirecting incoming http and https connections to the appropriate services/servers and ports.
Therefore, now when you hit http://.myservers.com or https://.myservers.com I'm contacting the nginx server for routing data to the appropriate IP and port.
NGINX Configuration
On nginx, setup a proxy host for your Plex instances e.g., plex.myservers.com. Route it to the host IP of your Plex server, and appropriate port i.e. 32400. Configure this proxy host to use SSL, I use DynuDNS for this free SSL certs too. Make the certificate a wildcard, so *.myservers.com and myservers.com are covered - this will allow you to secure any subdomains you create. Configure your Plex network settings. You do not need remote access enabled on your Plex service, strangely. Disable relay, you are going to steam directly from your network. Configure Custom server access URLs to have your domain covered e.g., https://plex.myservers.com
Extended NGINX Configuration
Additionally I found the following advanced configurations were required for my plex proxy host in nginx:
proxy_set_header Host $http_host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "Upgrade";
location = / {
return 301 /web;
}
Explanation:
proxy_set_header Host $http_host;
Purpose: Preserves the original host header from the client request
Why it matters: Ensures Plex knows which domain was requested (plex.macleod.systems)
proxy_set_header X-Real-IP $remote_addr;
Purpose: Passes the client's actual IP address to Plex
Why it matters: Allows Plex to log the correct client IP instead of seeing all traffic coming from your Nginx proxy
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
Purpose: Maintains the chain of IP addresses a request has traversed
Why it matters: Preserves the complete request path, essential for Plex authentication and security checks
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "Upgrade";
Purpose: Enables WebSocket support
Why it matters: Plex uses WebSockets for real-time updates and status information in the web interface
Redirection Rule
location = / {
return 301 /web;
}
Purpose: Automatically redirects users from the root URL to the /web path
Why it matters: Plex specifically requires the /web path to load its web interface; this saves users from having to type /web manually
Summary
At this point you should be good, if you run pi-hole on your network like me, I needed to configure a local DNS for plex.myservers.com to point to my nginx IP, so the local streaming wouldn't go out through the WAN.