diff --git a/nginx.conf b/nginx.conf index 75bbc6004..c3817f17a 100644 --- a/nginx.conf +++ b/nginx.conf @@ -7,7 +7,6 @@ http { listen ${PORT}; listen [::]:${PORT}; - # Route websockets traffic to port 3001 location /websockets { proxy_pass http://${HOSTNAME}:3001; proxy_http_version 1.1; @@ -16,9 +15,8 @@ http { proxy_set_header Host $http_host; } - # Route all other traffic to port 3000 location / { - proxy_pass http://${HOSTNAME}:3000; + proxy_pass http://${HOSTNAME}:${INTERNAL_NEXTJS_PORT}; proxy_set_header Host $http_host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; diff --git a/scripts/run.sh b/scripts/run.sh index 3475831ec..bcde4c8bb 100644 --- a/scripts/run.sh +++ b/scripts/run.sh @@ -18,13 +18,10 @@ fi export AUTH_SECRET=$(openssl rand -base64 32) export PORT=${PORT:-7575} +export INTERNAL_NEXTJS_PORT=7901 -# Start nginx proxy -# 1. Replace the HOSTNAME and PORT in the nginx template file -# 2. Create the nginx configuration file from the template -# 3. Start the nginx server export HOSTNAME -envsubst '${HOSTNAME} ${PORT}' < /etc/nginx/templates/nginx.conf > /etc/nginx/nginx.conf +envsubst '${HOSTNAME} ${PORT} ${INTERNAL_NEXTJS_PORT}' < /etc/nginx/templates/nginx.conf > /etc/nginx/nginx.conf # Start services in the background and store their PIDs nginx -g 'daemon off;' & NGINX_PID=$! @@ -38,7 +35,7 @@ else REDIS_PID=$! fi -PORT=3000 node apps/nextjs/server.js & +PORT=$INTERNAL_NEXTJS_PORT node apps/nextjs/server.js & NEXTJS_PID=$! # Function to handle SIGTERM and shut down services