From b8255b0f62da530713e81bdf93c9560569c1c353 Mon Sep 17 00:00:00 2001 From: Daisuke Bauza <144384874+daisuke1227@users.noreply.github.com> Date: Wed, 17 Sep 2025 14:48:56 -0400 Subject: [PATCH] fixed nginx config and all configs (#167) Basically the nginx config that was used will have this bug called "peer data channel closed" that will happen every single 3 minutes or so and then it will automatically reconnect the nginx file basically whenever someone was in HTTPS instead of HTTP it will just not trust it but with the nginx config and adding the headers the browser will trust the WS connection --- community/scripts/aws-linux.sh | 32 +++++++++++++++--------------- community/scripts/ubuntu-debian.sh | 32 +++++++++++++++--------------- traefik/install | 24 ++++++++++++++-------- 3 files changed, 48 insertions(+), 40 deletions(-) diff --git a/community/scripts/aws-linux.sh b/community/scripts/aws-linux.sh index 3034e7e..cab3b2b 100644 --- a/community/scripts/aws-linux.sh +++ b/community/scripts/aws-linux.sh @@ -575,29 +575,30 @@ server { listen 80; server_name ${DOMAIN}; - # Public rooms: no authentication - location ~ ^/${PATH_PREFIX}/.*$ { + location / { proxy_pass http://127.0.0.1:${DOCKER_PORT}; + proxy_set_header Host \$host; proxy_http_version 1.1; + + # WebSocket headers proxy_set_header Upgrade \$http_upgrade; proxy_set_header Connection "upgrade"; - proxy_set_header Host \$host; + + # Forwarding headers for reverse proxy + 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_cache_bypass \$http_upgrade; + proxy_buffering off; + proxy_read_timeout 900s; } # Admin Panel Restricted Access - location / { + location ~ ^/$ { auth_basic "Restricted Access"; auth_basic_user_file /etc/nginx/.htpasswd; - - error_log /var/log/nginx/auth_error.log warn; - proxy_pass http://127.0.0.1:${DOCKER_PORT}; - proxy_http_version 1.1; - proxy_set_header Upgrade \$http_upgrade; - proxy_set_header Connection "upgrade"; - proxy_set_header Host \$host; - proxy_cache_bypass \$http_upgrade; } } EOF @@ -666,8 +667,8 @@ usage() { echo -e "${YELLOW}Usage:${NC} $0 {add|remove|list|change-password} [username]" echo -e "${YELLOW}Commands:${NC}" echo -e " ${GREEN}add${NC} Add a new user or update an existing user's password" - echo -e " ${GREEN}remove${NC} Remove a user" - echo -e " ${GREEN}list${NC} List all users" + echo -e " ${GREEN}remove${NC} Remove a user" + echo -e " ${GREEN}list${NC} List all users" echo -e " ${GREEN}change-password${NC} Change the password of an existing user" exit 1 } @@ -797,5 +798,4 @@ echo -e "${AQUA}\n==================================================${NC}" # Final message -echo -e "${GREEN}Installation complete! Access your Neko Rooms at https://${DOMAIN}${NC}" - +echo -e "${GREEN}Installation complete! Access your Neko Rooms at https://${DOMAIN}${NC}" \ No newline at end of file diff --git a/community/scripts/ubuntu-debian.sh b/community/scripts/ubuntu-debian.sh index 8d453ea..e9ff6f7 100644 --- a/community/scripts/ubuntu-debian.sh +++ b/community/scripts/ubuntu-debian.sh @@ -575,29 +575,30 @@ server { listen 80; server_name ${DOMAIN}; - # Public rooms: no authentication - location ~ ^/${PATH_PREFIX}/.*$ { + location / { proxy_pass http://127.0.0.1:${DOCKER_PORT}; + proxy_set_header Host \$host; proxy_http_version 1.1; + + # WebSocket headers proxy_set_header Upgrade \$http_upgrade; proxy_set_header Connection "upgrade"; - proxy_set_header Host \$host; + + # Forwarding headers for reverse proxy + 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_cache_bypass \$http_upgrade; + proxy_buffering off; + proxy_read_timeout 900s; } # Admin Panel Restricted Access - location / { + location ~ ^/$ { auth_basic "Restricted Access"; auth_basic_user_file /etc/nginx/.htpasswd; - - error_log /var/log/nginx/auth_error.log warn; - proxy_pass http://127.0.0.1:${DOCKER_PORT}; - proxy_http_version 1.1; - proxy_set_header Upgrade \$http_upgrade; - proxy_set_header Connection "upgrade"; - proxy_set_header Host \$host; - proxy_cache_bypass \$http_upgrade; } } EOF @@ -667,8 +668,8 @@ usage() { echo -e "${YELLOW}Usage:${NC} $0 {add|remove|list|change-password} [username]" echo -e "${YELLOW}Commands:${NC}" echo -e " ${GREEN}add${NC} Add a new user or update an existing user's password" - echo -e " ${GREEN}remove${NC} Remove a user" - echo -e " ${GREEN}list${NC} List all users" + echo -e " ${GREEN}remove${NC} Remove a user" + echo -e " ${GREEN}list${NC} List all users" echo -e " ${GREEN}change-password${NC} Change the password of an existing user" exit 1 } @@ -798,5 +799,4 @@ echo -e "${AQUA}\n==================================================${NC}" # Final message -echo -e "${GREEN}Installation complete! Access your Neko Rooms at https://${DOMAIN}${NC}" - +echo -e "${GREEN}Installation complete! Access your Neko Rooms at https://${DOMAIN}${NC}" \ No newline at end of file diff --git a/traefik/install b/traefik/install index 3471051..488b8d1 100755 --- a/traefik/install +++ b/traefik/install @@ -2,13 +2,14 @@ echo " --------------------------------------------------------------- - __ - ____ ___ / /______ _________ ____ ____ ___ _____ - / __ \/ _ \/ //_/ __ \ / ___/ __ \/ __ \/ __ '__ \/ ___/ - / / / / __/ ,< / /_/ /_____/ / / /_/ / /_/ / / / / / (__ ) -/_/ /_/\___/_/|_|\____/_____/_/ \____/\____/_/ /_/ /_/____/ - - Automatic installer by m1k1o + + ____ ___ / /______ _________ ____ ____ ___ _____ + / __ \/ _ \/ //_/ __ \ / ___/ __ \/ __ \/ __ '__ \/ ___/ + / / / / __/ ,< / /_/ /_____/ / / /_/ / /_/ / / / / / (__ ) + /_/ /_/\___/_/|_|\____/_____/_/ \____/\____/_/ /_/ /_/____/ + + + Automatic installer by m1k1o --------------------------------------------------------------- You need to have: @@ -166,6 +167,12 @@ while true; do break done +PUBLIC_IP=$(curl -s https://ipinfo.io/ip) +read -rp "Enter your server's public IP address (autodetected: ${PUBLIC_IP}): " NEKO_NAT1TO1 +if [[ -z "${NEKO_NAT1TO1}" ]]; then + NEKO_NAT1TO1="${PUBLIC_IP}" +fi + touch "./usersfile" # Users @@ -209,6 +216,7 @@ echo "[Y] Got all settings..." echo "NEKO_ROOMS_TRAEFIK_ENTRYPOINT=websecure" echo "NEKO_ROOMS_TRAEFIK_NETWORK=neko-rooms-traefik" echo "NEKO_ROOMS_TRAEFIK_CERTRESOLVER=lets-encrypt" + echo "NEKO_NAT1TO1=${NEKO_NAT1TO1}" } > .env echo "[Y] Creating env..." @@ -246,4 +254,4 @@ else docker compose up -d fi -echo "[Y] Finished! You can now visit https://${NEKO_ROOMS_TRAEFIK_DOMAIN}/" +echo "[Y] Finished! You can now visit https://${NEKO_ROOMS_TRAEFIK_DOMAIN}/" \ No newline at end of file