Skip to content

Commit 265a506

Browse files
committed
startup: remove default nginx conf to avoid nested server blocks
1 parent 07d45ab commit 265a506

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

startup.sh

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,15 @@ sed -i "s|__BACKEND_BASE_URL__|${BACKEND}|g" /etc/nginx/conf.d/api-proxy.conf
115115

116116
echo "✅ Wrote /etc/nginx/conf.d/api-proxy.conf (proxy -> ${BACKEND}/api/)"
117117

118+
# Remove any default server-level configuration that may exist in /etc/nginx/conf.d
119+
# (for example the base image's default.conf). Our custom nginx.conf expects the
120+
# conf.d fragments to contain only `location` blocks; a top-level `server { ... }`
121+
# in conf.d will cause nginx to error with: "'server' directive is not allowed here".
122+
if [ -f /etc/nginx/conf.d/default.conf ]; then
123+
echo "⚠️ Removing /etc/nginx/conf.d/default.conf to avoid nested server blocks"
124+
rm -f /etc/nginx/conf.d/default.conf || true
125+
fi
126+
118127
# Start nginx
119128
echo "🌐 Starting nginx..."
120129
exec nginx -g "daemon off;"

0 commit comments

Comments
 (0)