0

I am trying to link all the services on my network together with nginx. One of those services is Plex. The nginx server is running inside docker on 192.168.1.150:80. The plex server is running on 192.168.1.149:32400. I also have a homer instance running on 192.168.1.148:80 I have a working config (see below), but I want to change something that I do not know how.

Nginx.conf:

user nginx;
worker_processes 5;

events {
    worker_connections 2048;
}

http {
    server {
        location / {
            proxy_pass http://192.168.1.148:80;
        }

        location /plex {
            proxy_pass http://192.168.1.149:32400/web;
        }

        location /web {
            proxy_pass http://192.168.1.149:32400/web;
        }
    }
}

As you can see, because plex requests resources from subdomain '/web', I have to add the proxy_pass for /web to go to plex as well. This is far from ideal when I want to use the subdomain /web for something else. The plex's index.html requests some script from /web/.... Is there some way to have this request go to /plex/web, so that I can catch it in that subdomain and not in the global one. This way I can use /web for something else.

Thanks in advance ExellentCoin

1 Answers1

0

Not sure if you found a solution but came across your post researching Plex configs and had the same question. This is what I came up with and works:

location /plex/ {
    proxy_pass http://192.168.68.102:32400/;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_set_header X-Forwarded-Host   $server_name;
    proxy_ssl_verify off;
    proxy_http_version 1.1;
    proxy_set_header Host $host;
    proxy_set_header Upgrade $http_upgrade;
    proxy_set_header Connection "upgrade";
    proxy_read_timeout 86400;
}
if ($http_referer ~ /plex/) {
    rewrite ^/web/(.*) /plex/web/$1? redirect;
}
  • Thanks for the answer. I have not found a solution yet. unfortunately I am not able to give this answer a go for now. The server I was performing this on has been shut down for quite a while now, because its drives are completely full. This will remain so for at least the coming moth, month and a half. After which I will definitely try it out. – ExellentCoin Jul 17 '22 at 15:07