Skip to content
mb edited this page Jun 23, 2017 · 19 revisions

Welcome to the plex-gentoo-ebuilds wiki!

Branches

  • master is kept for default & compat, merging in plexpublic (well, that's the plan at least).
  • plexpublic only public releases here, use this (or master) when you're not a plexpass subscriber.
  • plexpass only plexpass releases here, and those public that == for plexpass and public users.

Example nginx reverse proxy configuration

The following config is a plex in subdir ssl reverse proxy nginx example (one I use), e.g. https://plex.pvt/plex

  # nginx conf, ssl, reverse proxy.
  server {
    listen 80;
    listen 443 ssl;
    server_name me.pvt;  # change me
    root /home/mywebdir; # change me

    # ssl
    ssl_certificate /home/mywebdir/me.pvt.crt;     # change me
    ssl_certificate_key /home/mywebdir/me.pvt.key; # change me
    ssl_dhparam /home/mywebdir/me.pvt.dhparam;     # change me

    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/mywebdir/me.access main; # change me
    error_log /home/mywebdir/me.errors;       # change me

    # 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.0.0/24;  # change me
        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;
        }
    }
    }
Clone this wiki locally