NGINX WebSocket and Proxy Improvements (#170)

This commit is contained in:
H1ghSyst3m
2025-09-26 09:00:39 +02:00
committed by GitHub
parent e2688cb853
commit 5028a28255
+27 -6
View File
@@ -571,34 +571,55 @@ echo -e "${AQUA}\n==================================================${NC}"
# Configure NGINX without SSL # Configure NGINX without SSL
echo -e "${YELLOW}Configuring NGINX without SSL...${NC}" echo -e "${YELLOW}Configuring NGINX without SSL...${NC}"
cat <<EOF > /etc/nginx/sites-available/${DOMAIN}-neko-rooms.conf cat <<EOF > /etc/nginx/sites-available/${DOMAIN}-neko-rooms.conf
map \$http_upgrade \$connection_upgrade {
default upgrade;
'' close;
}
server { server {
listen 80; listen 80;
server_name ${DOMAIN}; server_name ${DOMAIN};
location / { location ^~ /${PATH_PREFIX}/ {
proxy_pass http://127.0.0.1:${DOCKER_PORT}; proxy_pass http://127.0.0.1:${DOCKER_PORT};
proxy_set_header Host \$host; proxy_set_header Host \$host;
proxy_http_version 1.1; proxy_http_version 1.1;
# WebSocket headers # WebSocket headers
proxy_set_header Upgrade \$http_upgrade; proxy_set_header Upgrade \$http_upgrade;
proxy_set_header Connection "upgrade"; proxy_set_header Connection \$connection_upgrade;
# Forwarding headers for reverse proxy # Forwarding headers for reverse proxy
proxy_set_header X-Real-IP \$remote_addr; proxy_set_header X-Real-IP \$remote_addr;
proxy_set_header X-Forwarded-For \$proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-For \$proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto \$scheme; proxy_set_header X-Forwarded-Proto \$scheme;
proxy_cache_bypass \$http_upgrade; proxy_connect_timeout 60s;
proxy_buffering off; proxy_send_timeout 4h;
proxy_read_timeout 900s; proxy_read_timeout 4h;
send_timeout 900s;
proxy_request_buffering off;
proxy_buffering off;
} }
# Admin Panel Restricted Access # Admin Panel Restricted Access
location ~ ^/$ { location / {
auth_basic "Restricted Access"; auth_basic "Restricted Access";
auth_basic_user_file /etc/nginx/.htpasswd; auth_basic_user_file /etc/nginx/.htpasswd;
proxy_pass http://127.0.0.1:${DOCKER_PORT}; proxy_pass http://127.0.0.1:${DOCKER_PORT};
proxy_set_header Host \$host;
proxy_http_version 1.1;
# Falls das Admin-UI WebSockets nutzt, sind wir vorbereitet
proxy_set_header Upgrade \$http_upgrade;
proxy_set_header Connection \$connection_upgrade;
# Forwarding headers wie oben
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;
} }
} }
EOF EOF