-
Notifications
You must be signed in to change notification settings - Fork 0
Home
mb edited this page Apr 26, 2017
·
19 revisions
Welcome to the plex-gentoo-ebuilds wiki!
The following config is a plex in subdir ssl reverse proxy nginx example (one I use).
# nginx conf, ssl, reverse proxy.
server {
listen 80;
listen 443 ssl;
server_name plex.pvt;
root /home/plexdir;
# ssl
ssl_certificate /home/plexdir/plex.pvt.crt;
ssl_certificate_key /home/plexdir/plex.pvt.key;
ssl_dhparam /home/plexdir/plex.pvt.dhparam;
ssl_session_cache shared:SSL:50m;
ssl_session_timeout 10m;
ssl_prefer_server_ciphers on;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_ciphers "ECDHE-RSA-AES256-GCM-SHA384:ECDHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384:DHE-RSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-SHA384:ECDHE-RSA-AES128-SHA256:ECDHE-RSA-AES256-SHA:ECDHE-RSA-AES128-SHA:DHE-RSA-AES256-SHA256:DHE-RSA-AES128-SHA256:DHE-RSA-AES256-SHA:DHE-RSA-AES128-SHA:ECDHE-RSA-DES-CBC3-SHA:EDH-RSA-DES-CBC3-SHA:AES256-GCM-SHA384:AES128-GCM-SHA256:AES256-SHA256:AES128-SHA256:AES256-SHA:AES128-SHA:DES-CBC3-SHA:HIGH:!aNULL:!eNULL:!EXPORT:!DES:!MD5:!PSK:!RC4";
add_header Strict-Transport-Security "max-age=31536000; includeSubDomains" always;
# logging
access_log /home/plexdir/plex.access main;
error_log /home/plexdir/plex.errors;
# plex top locations
location ~ ^/(\?(?:.*)(X-Plex-Device=)|web|video|photo|library|web|status|system|updater|clients|:|playQueues)(.*) {
proxy_pass http://localhost:32400;
proxy_redirect http://localhost:32400 /;
# set some headers and proxy stuff.
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_redirect off;
# include Host header
proxy_set_header Host $host;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_read_timeout 36000s;
proxy_pass_request_headers on;
}
# plex subdir
location /plex {
if ($scheme = 'http') {
rewrite ^ https://$host$request_uri? permanent;
}
rewrite_log on;
rewrite ^/plex(.*)$ /web$1 break;
proxy_pass http://localhost:32400;
proxy_headers_hash_max_size 51200;
proxy_headers_hash_bucket_size 6400;
proxy_set_header X-Forwarded-for $proxy_add_x_forwarded_for;
proxy_set_header Host $host;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_read_timeout 36000s;
proxy_pass_request_headers on;
}
# root anything not plex
location / {
allow 192.168.1.0/24;
allow 127.0.0.1;
deny all;
# for plex
if ($args ~ (.*)X-Plex-Device(.*)) {
proxy_pass http://localhost:32400;
}
if ($http_referer ~ (.*)plex(.*)) {
proxy_pass http://localhost:32400;
}
}
}
.