Skip to content

Instantly share code, notes, and snippets.

@spikegrobstein
Last active July 26, 2025 20:11
Show Gist options
  • Select an option

  • Save spikegrobstein/4384954 to your computer and use it in GitHub Desktop.

Select an option

Save spikegrobstein/4384954 to your computer and use it in GitHub Desktop.

Revisions

  1. spikegrobstein revised this gist Jun 30, 2013. 1 changed file with 0 additions and 2 deletions.
    2 changes: 0 additions & 2 deletions nginx.conf
    Original file line number Diff line number Diff line change
    @@ -24,8 +24,6 @@ server {
    rewrite ^/$ http://$http_host/web/index.html;
    }

    rewrite ^/$ http://$http_host/web/index.html;

    # 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;
  2. spikegrobstein revised this gist Jun 30, 2013. 1 changed file with 6 additions and 0 deletions.
    6 changes: 6 additions & 0 deletions nginx.conf
    Original file line number Diff line number Diff line change
    @@ -18,6 +18,12 @@ server {
    # this is where everything cool happens (you probably don't need to change anything here):
    location / {
    # if a request to / comes in, 301 redirect to the main plex page.
    # but only if it doesn't contain the X-Plex-Device-Name header
    # this fixes a bug where you get permission issues when accessing the web dashboard
    if ($http_x_plex_device_name = '') {
    rewrite ^/$ http://$http_host/web/index.html;
    }

    rewrite ^/$ http://$http_host/web/index.html;

    # set some headers and proxy stuff.
  3. spikegrobstein revised this gist Jun 18, 2013. 1 changed file with 1 addition and 0 deletions.
    1 change: 1 addition & 0 deletions nginx.conf
    Original file line number Diff line number Diff line change
    @@ -20,6 +20,7 @@ server {
    # if a request to / comes in, 301 redirect to the main plex page.
    rewrite ^/$ http://$http_host/web/index.html;

    # 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;
  4. spikegrobstein revised this gist Jun 18, 2013. 1 changed file with 4 additions and 2 deletions.
    6 changes: 4 additions & 2 deletions nginx.conf
    Original file line number Diff line number Diff line change
    @@ -1,13 +1,14 @@
    upstream plex-upstream {
    # change plex-server.example.com:32400 to the hostname:port of your plex server. this can be localhost.
    # change plex-server.example.com:32400 to the hostname:port of your plex server.
    # this can be "localhost:32400", for instance, if Plex is running on the same server as nginx.
    server plex-server.example.com:32400;
    }

    server {
    listen 80;

    # server names for this server.
    # any requests that come in that match these names will use the proxy.
    # any requests that come in that match any these names will use the proxy.
    server_name
    tv
    plex
    @@ -16,6 +17,7 @@ server {

    # this is where everything cool happens (you probably don't need to change anything here):
    location / {
    # if a request to / comes in, 301 redirect to the main plex page.
    rewrite ^/$ http://$http_host/web/index.html;

    proxy_set_header X-Real-IP $remote_addr;
  5. spikegrobstein revised this gist Jun 18, 2013. 1 changed file with 3 additions and 0 deletions.
    3 changes: 3 additions & 0 deletions nginx.conf
    Original file line number Diff line number Diff line change
    @@ -1,17 +1,20 @@
    upstream plex-upstream {
    # change plex-server.example.com:32400 to the hostname:port of your plex server. this can be localhost.
    server plex-server.example.com:32400;
    }

    server {
    listen 80;

    # server names for this server.
    # any requests that come in that match these names will use the proxy.
    server_name
    tv
    plex
    tv.example.com
    plex.example.com;

    # this is where everything cool happens (you probably don't need to change anything here):
    location / {
    rewrite ^/$ http://$http_host/web/index.html;

  6. spikegrobstein renamed this gist Dec 27, 2012. 1 changed file with 0 additions and 0 deletions.
    File renamed without changes.
  7. spikegrobstein revised this gist Dec 27, 2012. 1 changed file with 4 additions and 4 deletions.
    8 changes: 4 additions & 4 deletions gistfile1.nginxconf
    Original file line number Diff line number Diff line change
    @@ -7,10 +7,10 @@ server {

    # server names for this server.
    server_name
    tv
    plex
    tv.example.com
    plex.example.com;
    tv
    plex
    tv.example.com
    plex.example.com;

    location / {
    rewrite ^/$ http://$http_host/web/index.html;
  8. spikegrobstein revised this gist Dec 27, 2012. 1 changed file with 10 additions and 10 deletions.
    20 changes: 10 additions & 10 deletions gistfile1.nginxconf
    Original file line number Diff line number Diff line change
    @@ -1,28 +1,28 @@
    upstream plex-upstream {
    server plex-server.example.com:32400;
    server plex-server.example.com:32400;
    }

    server {
    listen 80;
    # server names for this server.

    # server names for this server.
    server_name
    tv
    plex
    tv.example.com
    plex.example.com;
    tv
    plex
    tv.example.com
    plex.example.com;

    location / {
    rewrite ^/$ http://$http_host/web/index.html;
    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;

    # include Host header
    # include Host header
    proxy_set_header Host $http_host;

    # proxy request to plex server
    # proxy request to plex server
    proxy_pass http://plex-upstream;
    }
    }
  9. spikegrobstein revised this gist Dec 27, 2012. No changes.
  10. spikegrobstein created this gist Dec 27, 2012.
    28 changes: 28 additions & 0 deletions gistfile1.nginxconf
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,28 @@
    upstream plex-upstream {
    server plex-server.example.com:32400;
    }

    server {
    listen 80;

    # server names for this server.
    server_name
    tv
    plex
    tv.example.com
    plex.example.com;

    location / {
    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;

    # include Host header
    proxy_set_header Host $http_host;

    # proxy request to plex server
    proxy_pass http://plex-upstream;
    }
    }