Skip to content

Instantly share code, notes, and snippets.

@tclegg
Last active March 4, 2024 17:41
Show Gist options
  • Save tclegg/1b044534375523d6c93a11d61e57c091 to your computer and use it in GitHub Desktop.
Save tclegg/1b044534375523d6c93a11d61e57c091 to your computer and use it in GitHub Desktop.
Nginx Reverse Proxy for Organizr
add to the bottom of the server block in /config/nginx/site-confs/default
include /config/nginx/proxy/*;
comment out the PHP location block and the index.php in the location / { try ... }
I don't have the http redirect figured out yet. It would probably work if I was using a real domain name, intead of an IP to access, but I'll add that in the future.
create a .conf file for each proxied container.
organizr.conf
sonarr.conf
etc...
Sonarr and Radarr have to be configured with a baseurl for reverse proxy. Since the location block is using /sonarr, configure the baseurl as /sonarr
Create a network (I used the name isolated) in docker using the MACVLAN or BRIDGE driver. Creating the second network allows the containers to communicate using the docker DNS, instead of specifying the host ip/domain name. This also allows communication between the containers to never leave the docker network on the host machine.
####################
## Docker Network ##
####################
docker network create -d macvlan \
--subnet=172.18.0.0/24 \
--gateway=172.18.0.1 \
-o parent=docker0
#################################
## ATTACH CONTAINER TO NETWORK ##
#################################
docker network connect [network name] [container id or name]
------------------------PLEX DOCKER--------------------------------
##############################################################
## This will create the container using the bridge network. ##
## Without the bridge you cannot add the macvlan ##
##############################################################
docker create \
--name plex \
-e VERSION=latest \
-e PUID=<UID> \
-e PGID=<GID> \
-p 32400:32400/tcp \
-p 3005:3005/tcp \
-p 8324:8324/tcp \
-p 32469:32469/tcp \
-p 1900:1900/udp \
-p 32410:32410/udp \
-p 32412:32412/udp \
-p 32413:32413/udp \
-p 32414:32414/udp \
-e TZ="America/Chicago" \
-e ADVERTISE_IP="http://<SERVERIP>:32400/" \
-h <HOSTNAME> \
-e PLEX_CLAIM="<claimToken>" \
-v </path/to/config/>:/config \
-v </path/to/movies/>:/data/movies \
-v </path/to/tv/>:/data/tvshows \
-v </path/to/transcode/>:/transcode \
linuxserver/plex
---------------------------FILES-----------------------------------
#######################
## SONARR.CONF ##
#######################
location /sonarr {
# auth_request /auth-admin;
proxy_pass http://sonarr:8989/sonarr;
add_header X-Frame-Options "SAMEORIGIN";
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
--------------------------------------------------------------------
#######################
## RADARR.CONF ##
#######################
location /radarr {
# auth_request /auth-admin;
proxy_pass http://radarr:7878/radarr;
add_header X-Frame-Options "SAMEORIGIN";
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.CONF ##
###############
location /web {
proxy_pass http://plex:32400;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
location /plex {
proxy_pass http://plex/web;
}
--------------------------------------------------------------------
#######################
## ORGANIZR.CONF ##
#######################
##############################################
## ----Auth Admin---- ##
## (I don't use these, but they came in the ##
## tutorials I used, so I included them in ##
## comments for future use) ##
##############################################
#location /auth-admin {
# internal;
# #rewrite ^ /auth.php?admin&ban=someone,thisperson;
# proxy_pass http://organizr/auth.php?admin;
# proxy_set_header Content-Length "";
#}
###############
## Auth User ##
###############
#location /auth-user {
# internal;
# proxy_pass http://organizr/auth.php?user;
# proxy_set_header Content-Length "";
#}
###########
## Proxy ##
###########
location /organizr {
proxy_pass http://organizr/;
}
--------------------------------------------------------------------
#################
## NZBGET.conf ##
#################
location ~ ^/nzbget($|./*) {
rewrite /nzbget/(.*) /$1 break;
proxy_pass http://127.0.0.1:6789;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
location ~ ^/nzbget$ {
return 302 $scheme://$host$request_uri/;
}
--------------------------------------------------------------------
##################
## PLEX.CONF v2 ##
##################
location /plex {
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;
proxy_pass http://plex/;
}
--------------------------------------------------------------------
#######################
## PROXY.CONF ##
#######################
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-Host $host;
proxy_set_header X-Forwarded-Protocol $scheme;
proxy_set_header X-Forwarded-For $remote_addr;
proxy_set_header X-Forwarded-Port $server_port;
proxy_set_header X-Forwarded-Server $host;
proxy_connect_timeout 3600;
proxy_send_timeout 3600;
proxy_read_timeout 3600;
proxy_redirect off;
proxy_max_temp_file_size 0;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment