NGINX reverse proxy - Host unreachable

#PLEX
Server Version#: 1.15.6.1079
Player Version#: 3.95.2

I’ve been working on renewing my mediaserver the last few months and i’m nearing completion. The problem i am facing right now is that the host is unreachable and i cant seem to figure out how to solve it.

These are the versions i’m currently running with:

#server:
$ lsb_release -a
Distributor ID: Ubuntu
Description: Ubuntu 18.04.2 LTS
Release: 18.04
Codename: bionic

#NGINX:
$ nginx -v
nginx version: nginx/1.14.0 (Ubuntu)

#Docker:
$ docker --version
Docker version 18.09.6, build 481bc77

The server is running docker with the Plex container. The container is running just fine, i can access plex via http://ipaddress:32400. I can also access it via http://hostname:32400 just fine. It’s also able to access the server itself and add libraries. (not sure how to call these 2 different aspects: webUI and PMS respectively?)

I am also running NGINX as the reverse proxy in order to make the URLs easier to remember (i.e. http://hostname/app). I have other apps running without any problems, i.e. i can access Portainer via http://hostname/portainer without any problems.

The only thing i cant seem to get to work is plex. I’ve read several posts on how people have configured NGINX, but i can only access the WebUI, the server on the other hand becomes The server "hostname" is unavailable when i try to access it via http://hostname/plex. I did find that reverse proxying this is tricky (to say the least) as plex listens to http://address:32400/web and not just the port.

Here’s the snippet of my reverse proxy:

I excluded some other locations to shorten the list.

I don’t use SSL, traffic goes on HTTP. I’ve edited the settings in PLEX and Disabled “Secured connections”.

From what it feels like, the moment i try to use http://hostname/plex it somehow can’t see the port or something and thus the server?
I’ve created a rewrite which works fine, so i can access Plex with the shortened URL, except its not the prettiest way. I hope to solve this with a correct proxy.
When i type http://hostname/plex it redirects to http://hostname/web/index.html which should be correct (or at least, correct enough).

I tried some alterations to the proxy_pass for example:

Honestly, it gets a bit clouded after trying several variants. From what i understood is that, you need 2 location one to redefine 32400/web and the other to make it look like /plex. i might be wrong here.

How can i access plex via http://hostname/plex AND find the server in question? what am i doing wrong in NGINX? Any help or directions are much appreciated!

Plex does some odd things with it’s web server, presumably to make it easier to access it from the “official” web interface at “https://app.plex.tv/desktop”. Instead of trying to proxy the Plex server, I’d just set up a redirect from “http://easytoremember.com/” to “http://address:32400/web”.

Yea, so it would seem. Everything i can find on the internet basically says you can do it, but none of those solutions work (at least not now or in my situation).

I guess i have no other choice than to redirect it to the original URL.

Don’t know if it is of any help (I am not running PMS in docker) I managed to get it working with access to my PMS via a subdomain, while some other services run as /servicename

e.g.

plex.mydomain.com -> takes me to my PMS
plex.mydomain.com/webtools -> takes me to my webtools plugin
plex.mydomain.com/plexpy -> takes me to my tautulli 
(I did set all this up a while ago, when tautulli was plexpy)

Edit, just saw this as well, so that poster might be able to help.

The concept would stay the same, whether you run it locally or within docker. I’ve seen the post you’ve linked and several others that look similar to it. They all list “solutions” but they have configured it with SSL. When i remove/uncomment the SSL parts, i cant get it to work. Not to mention that the example doesn’t use a “/plex”-route but to the root (/) of the domain itself.

Personally i rather not use subdomains, i rather stick to the same system for all applications. I guess this is a bit of personal flavor. It feels more logical to use domain.com/application rather than application.domain.com. Potatoo’s <> Potaato’s probably.
If there is a specific reason that plex is incapable of being used with a subfolder-system, i’m all ears. So far i have not found an answer to that either.

I appreciate the input nontheless @blim5001.

I decided to stick with the rewrite-option, it does what it needs to do, even if it doesn’t meet my preferences.

For anyone else who wants to use “/plex” as option, this is the rewrite (for NGINX):

# PLEX (Rewriting URL)
location /plex {
    rewrite ^/plex(.*) http://$server_name:32400/web/$1 permanent;

To clarify: if you type domain.com/plex it will rewrite the url to domain.com:32400/web.

1 Like

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.