jelmew
jelmew

Reputation: 583

Getting a nginx reverse proxy to work with plex

Since a recent update of plex, my reverxe proxy for plex stopped working. I tried searching all around, but I didn't find much info. Listed below is the config file, does anyone have plex and know what goes wrong? I simply get served with a 404 not found page

server {
  listen 80;

  if ($http_referer ~* /plex/) {
    rewrite ^/web/(.*) /plex/$1? redirect;
  }
  root /var/www;

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

  location /plexapi/ {
    proxy_pass http://127.0.0.1:32400/;
  }

}

Upvotes: 1

Views: 5752

Answers (2)

radar
radar

Reputation: 510

Here is mine which works perfectly:

server {
        listen        443;
        server_name  plex.mydoamin.com ;
        satisfy any;
        ssl_certificate /etc/letsencrypt/live/mydomain.com/fullchain.pem;
        ssl_certificate_key /etc/letsencrypt/live/mydomain.com/privkey.pem;


        location = / {
                rewrite ^ /web/;
                proxy_redirect http:// $scheme://;
                proxy_set_header Host $host;
                proxy_set_header X-Real-IP $remote_addr;
                proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
                proxy_set_header X-Forwarded-Proto $scheme;
        }
        location / {
                proxy_pass  http://192.168.1.14:32400/;
                proxy_redirect http:// $scheme://;
                proxy_set_header Host $host;
                proxy_set_header X-Real-IP $remote_addr;
                proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
                proxy_set_header X-Forwarded-Proto $scheme;
                index  index.html index.htm;
        }
 }

Upvotes: 1

Mark Stosberg
Mark Stosberg

Reputation: 13381

Some things to check:

  • Run `sudo netstat -nlp | grep ':32400' to make sure there is still something running on the expected port.
  • From withing the machine running Nginx and Plex, try connecting directly to the URL. Both of these should work: `curl http://127.0.0.1:32400/ and curl http://127.0.0.1:32400/web/ ;

If any of these tests fail, the problem with Plex and not Nginx. In which case, you post your Plex configurations.

It's also a good idea to check the Changelog for Plex. Are there mentions in the Changelog if changes that might be problematic for you since the last time you updated Plex?

Upvotes: 0

Related Questions