Fix nginx configuration issues with variable expansion
This commit is contained in:
10
deploy.sh
10
deploy.sh
@@ -99,17 +99,17 @@ else
|
|||||||
|
|
||||||
# Create a simpler nginx config for local deployment
|
# Create a simpler nginx config for local deployment
|
||||||
echo "Generating local nginx configuration..."
|
echo "Generating local nginx configuration..."
|
||||||
cat > nginx/app.conf << EOF
|
cat > nginx/app.conf << 'EOF'
|
||||||
server {
|
server {
|
||||||
listen 80;
|
listen 80;
|
||||||
server_name localhost;
|
server_name localhost;
|
||||||
|
|
||||||
location / {
|
location / {
|
||||||
proxy_pass http://web:8000;
|
proxy_pass http://web:8000;
|
||||||
proxy_set_header Host \$host;
|
proxy_set_header Host $host;
|
||||||
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;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
EOF
|
EOF
|
||||||
|
|||||||
@@ -93,8 +93,11 @@ EOF
|
|||||||
header "Configuring Nginx"
|
header "Configuring Nginx"
|
||||||
echo "Generating Nginx configuration..."
|
echo "Generating Nginx configuration..."
|
||||||
|
|
||||||
export DOMAIN_NAME=$domains
|
# Use sed instead of envsubst to only replace DOMAIN_NAME without affecting nginx variables
|
||||||
envsubst < ./nginx/app.conf.template > ./nginx/app.conf
|
cp ./nginx/app.conf.template ./nginx/app.conf
|
||||||
|
sed -i "s/\${DOMAIN_NAME}/$domains/g" ./nginx/app.conf
|
||||||
|
|
||||||
|
echo "Generated nginx configuration for domain: $domains"
|
||||||
|
|
||||||
# Stop any existing services
|
# Stop any existing services
|
||||||
echo "Stopping any existing services..."
|
echo "Stopping any existing services..."
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ server {
|
|||||||
}
|
}
|
||||||
|
|
||||||
location / {
|
location / {
|
||||||
return 301 https://$$host$$request_uri;
|
return 301 https://$host$request_uri;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -23,9 +23,9 @@ server {
|
|||||||
|
|
||||||
location / {
|
location / {
|
||||||
proxy_pass http://web:8000;
|
proxy_pass http://web:8000;
|
||||||
proxy_set_header Host $$host;
|
proxy_set_header Host $host;
|
||||||
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;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user