fixed nginx test
This commit is contained in:
@@ -112,8 +112,24 @@ chmod 600 .env
|
|||||||
|
|
||||||
echo ""
|
echo ""
|
||||||
echo "Setting up Nginx configuration..."
|
echo "Setting up Nginx configuration..."
|
||||||
cat nginx.conf.example | sed "s/yourdomain.com/$DOMAIN/g" > /tmp/faction-war-nginx.conf
|
# Create a basic HTTP-only config first (Certbot will add SSL)
|
||||||
cp /tmp/faction-war-nginx.conf /etc/nginx/sites-available/faction-war
|
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
|
ln -sf /etc/nginx/sites-available/faction-war /etc/nginx/sites-enabled/faction-war
|
||||||
|
|
||||||
# Remove default nginx site if it exists
|
# Remove default nginx site if it exists
|
||||||
@@ -123,9 +139,14 @@ echo ""
|
|||||||
echo "Testing Nginx configuration..."
|
echo "Testing Nginx configuration..."
|
||||||
nginx -t
|
nginx -t
|
||||||
|
|
||||||
|
echo ""
|
||||||
|
echo "Reloading Nginx..."
|
||||||
|
systemctl reload nginx
|
||||||
|
|
||||||
echo ""
|
echo ""
|
||||||
echo "Getting SSL certificate from Let's Encrypt..."
|
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 ""
|
||||||
echo "Setting up systemd service..."
|
echo "Setting up systemd service..."
|
||||||
|
|||||||
Reference in New Issue
Block a user