Created
July 13, 2018 16:19
-
-
Save drouarb/a58d0e366ca6a018f65593479a414801 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
server { | |
listen 80; | |
listen 443 default_server ssl; | |
server_name myplex.com; | |
# ssl on; | |
ssl_certificate /etc/nginx/ssl/cert.pem; | |
ssl_certificate_key /etc/nginx/ssl/key.pem; | |
client_body_timeout 240m; | |
access_log /var/log/nginx/access.log; | |
error_log /var/log/nginx/error.log; | |
# Other URL | |
location / { | |
# Specific rule for / | |
if ($http_x_plex_device_name = '') { | |
set $test A; | |
} | |
if ($arg_X-Plex-Device-Name = '') { | |
set $test "${test}B"; | |
} | |
if ($test = AB) { | |
rewrite ^/$ http://$http_host/web/index.html; | |
} | |
# Proxy configuration | |
proxy_pass http://127.0.0.1:3001; | |
proxy_set_header Host $host; | |
proxy_set_header X-Real-IP $remote_addr; | |
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; | |
# Plex proxy settings. | |
proxy_redirect off; | |
proxy_buffering off; | |
## Required for Websockets | |
proxy_http_version 1.1; | |
proxy_set_header Upgrade $http_upgrade; | |
proxy_set_header Connection "upgrade"; | |
proxy_read_timeout 36000s; ## Timeout after 10 hours | |
proxy_send_timeout 36000s; | |
proxy_connect_timeout 36000s; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment