Nginx Reverse Proxy for Plex Media Server

This is a working configuration file for Nginx to allow you to reverse proxy into your Plex Media Server. It has been spliced together from various sources.

Replace <> with your reverse proxy FQDN and <local IP address or hostname> with your internal IP address of your Plex Media Server.

# Configuration for Plex Media Server.
server {
  listen 443 ssl;
  server_name <>;
  ssl on;
  send_timeout 100m;
  ssl_stapling on;
  ssl_stapling_verify on;

  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;
  proxy_set_header Host $server_addr;
  proxy_set_header Referer $server_addr;
  proxy_set_header Origin $server_addr; 

  gzip on;
  gzip_vary on;
  gzip_min_length 1000;
  gzip_proxied any;
  gzip_types text/plain text/css text/xml application/xml text/javascript application/x-javascript image/svg+xml;
  gzip_disable "MSIE [1-6]\.";

  client_max_body_size 100M;

  proxy_set_header X-Plex-Client-Identifier $http_x_plex_client_identifier;
  proxy_set_header X-Plex-Device $http_x_plex_device;
  proxy_set_header X-Plex-Device-Name $http_x_plex_device_name;
  proxy_set_header X-Plex-Platform $http_x_plex_platform;
  proxy_set_header X-Plex-Platform-Version $http_x_plex_platform_version;
  proxy_set_header X-Plex-Product $http_x_plex_product;
  proxy_set_header X-Plex-Token $http_x_plex_token;
  proxy_set_header X-Plex-Version $http_x_plex_version;
  proxy_set_header X-Plex-Nocache $http_x_plex_nocache;
  proxy_set_header X-Plex-Provides $http_x_plex_provides;
  proxy_set_header X-Plex-Device-Vendor $http_x_plex_device_vendor;
  proxy_set_header X-Plex-Model $http_x_plex_model;

  # Web Sockets
  proxy_http_version 1.1;
  proxy_set_header Upgrade $http_upgrade;
  proxy_set_header Connection "upgrade";

  proxy_redirect off;
  proxy_buffering off;

  location / {
    proxy_pass http://<local IP address or hostname>:32400/;