From d11840cf13ebebe1b7f132c05ed78d8356054ac5 Mon Sep 17 00:00:00 2001 From: jerick Date: Wed, 28 Jan 2026 11:32:36 -0500 Subject: [PATCH] fixed nginx test --- setup_production.sh | 27 ++++++++++++++++++++++++--- 1 file changed, 24 insertions(+), 3 deletions(-) diff --git a/setup_production.sh b/setup_production.sh index 8b094e9..e3814cb 100644 --- a/setup_production.sh +++ b/setup_production.sh @@ -112,8 +112,24 @@ chmod 600 .env echo "" echo "Setting up Nginx configuration..." -cat nginx.conf.example | sed "s/yourdomain.com/$DOMAIN/g" > /tmp/faction-war-nginx.conf -cp /tmp/faction-war-nginx.conf /etc/nginx/sites-available/faction-war +# Create a basic HTTP-only config first (Certbot will add SSL) +cat > /etc/nginx/sites-available/faction-war << EOF +# Basic HTTP configuration - Certbot will add SSL +server { + listen 80; + listen [::]:80; + server_name $DOMAIN; + + location / { + proxy_pass http://127.0.0.1:8000; + 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; + } +} +EOF + ln -sf /etc/nginx/sites-available/faction-war /etc/nginx/sites-enabled/faction-war # Remove default nginx site if it exists @@ -123,9 +139,14 @@ echo "" echo "Testing Nginx configuration..." nginx -t +echo "" +echo "Reloading Nginx..." +systemctl reload nginx + echo "" echo "Getting SSL certificate from Let's Encrypt..." -certbot --nginx -d $DOMAIN --non-interactive --agree-tos --email $EMAIL +echo "Certbot will automatically configure SSL in the Nginx config" +certbot --nginx -d $DOMAIN --non-interactive --agree-tos --email $EMAIL --redirect echo "" echo "Setting up systemd service..."