Clean nginx code

This commit is contained in:
Alexandre
2022-12-17 21:02:32 +01:00
parent ea72d47480
commit 5ce7dc0d91

View File

@@ -3,8 +3,7 @@ server {
include /etc/nginx/includes/server_params.conf;
include /etc/nginx/includes/proxy_params.conf;
client_max_body_size 0;
server_name jellyfin.*;
root /usr/share/jellyfin/web;
root /usr/share/jellyfin;
index index.html;
# Security / XSS Mitigation Headers
@@ -12,36 +11,17 @@ server {
add_header X-XSS-Protection "1; mode=block";
add_header X-Content-Type-Options "nosniff";
location /web/ {
add_header Access-Control-Allow-Origin *;
proxy_pass http://127.0.0.1:8096/web/index.html;
proxy_buffering off;
proxy_read_timeout 30;
proxy_pass_request_headers on;
proxy_set_header Connection "Upgrade";
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Host $host;
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 X-Forwarded-Protocol $scheme;
proxy_set_header X-Forwarded-Host $http_host;
proxy_set_header Connection $http_connection;
location = / {
absolute_redirect off; # Do not add port to redirect
return 301 ./web/index.html; # The slash at the end is important.
proxy_set_header X-Forwarded-Proto $scheme; # Avoids mixed content
}
location ~ (/web)?/socket {
# Proxy Jellyfin Websockets traffic
location / {
proxy_pass http://127.0.0.1:8096;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_set_header Host $host;
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 X-Forwarded-Protocol $scheme;
proxy_set_header X-Forwarded-Host $http_host;
proxy_buffering off;
proxy_read_timeout 30;
proxy_pass_request_headers on;
}
}