Rewrite plex media server url on nginx? -
i have limited knowledge rewriting url in nginx. have plex media server running behind on nginx, can access dashboard http://domain.com/web/index.html these config found on github:
upstream plex-upstream { server plex-server.example.com:32400; } server { listen 80; server_name domain.com location / { if ($http_x_plex_device_name = '') { rewrite ^/$ http://$http_host/web/index.html; } proxy_set_header x-real-ip $remote_addr; proxy_set_header x-forwarded-for $proxy_add_x_forwarded_for; proxy_redirect off; proxy_set_header host $http_host; proxy_pass http://plex-upstream; } }
what want remove /web/index.html when go http://domain.com, pms dashboard load. tried 1 liner rewrite rules failed. thanks.
i not nginx specialist, had similar problem. diference not trying alias domain.name/ domain.name/web/, goal alias domain.name/plex/ domain.name/web/. getting redirects web/index.html solutions find except 1 configure plex media server reverse proxy nginx linux.
the 1 problem 1 if go web/ stay there.
so here creepy yet working solution:
upstream plex { server localhost:32400; } server { listen 80; server_name domain.name; server_name_in_redirect off; location / { proxy_pass http://localhost:8888; proxy_set_header x-real-ip $remote_addr; proxy_set_header x-forwarded-for $proxy_add_x_forwarded_for; proxy_set_header host $http_host; proxy_set_header x-nginx-proxy true; # enables ws support proxy_http_version 1.1; proxy_set_header upgrade $http_upgrade; proxy_set_header connection "upgrade"; proxy_redirect off; } location /web/index.html { if ($http_x_should_not_redirect = ""){ return 301 https://domain.name/plex/index.html; } proxy_pass https://plex; 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_should_not_redirect $host; } location /web { proxy_pass https://plex; 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_should_not_redirect $host; } location /plex { proxy_pass https://127.0.0.1/web; proxy_set_header x-should-not-redirect $host; } location /transmission/rpc { proxy_pass http://localhost:9091; proxy_set_header x-real-ip $remote_addr; proxy_set_header x-forwarded-for $proxy_add_x_forwarded_for; proxy_set_header host $http_host; proxy_set_header x-nginx-proxy true; # enables ws support proxy_http_version 1.1; proxy_set_header upgrade $http_upgrade; proxy_set_header connection "upgrade"; proxy_redirect off; } location /transmission/web { proxy_pass http://localhost:9091; proxy_pass_header x-transmission-session-id; proxy_set_header x-forwarded-host $host; proxy_set_header x-forwarded-server $host; proxy_set_header x-forwarded-for $proxy_add_x_forwarded_for; # enables ws support proxy_http_version 1.1; proxy_set_header upgrade $http_upgrade; proxy_set_header connection "upgrade"; proxy_redirect off; } listen 443 ssl; # managed certbot ssl_certificate /etc/letsencrypt/live/dovgastreetnas.viewdns.net/fullchain.pem; # managed certbot ssl_certificate_key /etc/letsencrypt/live/dovgastreetnas.viewdns.net/privkey.pem; # managed certbot include /etc/letsencrypt/options-ssl-nginx.conf; # managed certbot }
hope somebody.
Comments
Post a Comment