From 295149d8832b9e5bc2771b316097c132b8fda67d Mon Sep 17 00:00:00 2001 From: Otho Date: Fri, 20 Jan 2023 22:58:12 -0500 Subject: [PATCH] Add nginx server on feed interface. --- nginx/nginx.conf | 67 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 67 insertions(+) create mode 100644 nginx/nginx.conf diff --git a/nginx/nginx.conf b/nginx/nginx.conf new file mode 100644 index 0000000..d5c639a --- /dev/null +++ b/nginx/nginx.conf @@ -0,0 +1,67 @@ + +#user nobody; +worker_processes auto; + +# This default error log path is compiled-in to make sure configuration parsing +# errors are logged somewhere, especially during unattended boot when stderr +# isn't normally logged anywhere. This path will be touched on every nginx +# start regardless of error log location configured here. See +# https://trac.nginx.org/nginx/ticket/147 for more info. +# +#error_log /var/log/nginx/error.log; +# + +#pid logs/nginx.pid; + + +events { + worker_connections 1024; +} + + +http { + + upstream plex_backend { + server [::1]:32400; # replace 'plex' with the name you gave to your plex container if necessary! + keepalive 32; + } + + server { + listen [2603:3015:1003:566d::dad:feed]:80; + listen 10.1.9.10:80; + resolver [2603:3015:1003:5661::cede]; + server_name plex.othostash.com; + 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]\."; + + # Forward real ip and host to Plex + proxy_set_header Host $host; + proxy_set_header Referer localhost; + proxy_set_header Origin $scheme://localhost:$server_port; + proxy_set_header X-Real-IP $remote_addr; + #When using ngx_http_realip_module change $proxy_add_x_forwarded_for to '$http_x_forwarded_for,$realip_remote_addr' + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + proxy_set_header X-Forwarded-Proto $scheme; + proxy_set_header Sec-WebSocket-Extensions $http_sec_websocket_extensions; + proxy_set_header Sec-WebSocket-Key $http_sec_websocket_key; + proxy_set_header Sec-WebSocket-Version $http_sec_websocket_version; + proxy_set_header Accept-Encoding ""; + + # Websockets + proxy_http_version 1.1; + proxy_set_header Upgrade $http_upgrade; + proxy_set_header Connection "Upgrade"; + + # Buffering off send to the client as soon as the data is received from Plex. + proxy_redirect off; + proxy_buffering off; + + location / { + proxy_pass http://plex_backend; + } + } +}