@@ -58,8 +58,7 @@ export BEACH_NGINX_CUSTOM_METRICS_TARGET_PORT=${BEACH_NGINX_CUSTOM_METRICS_TARGE
5858
5959export NGINX_CUSTOM_ERROR_PAGE_TARGET=${NGINX_CUSTOM_ERROR_PAGE_TARGET:-${BEACH_NGINX_CUSTOM_ERROR_PAGE_TARGET:-}}
6060
61- export NGINX_UPSTREAM_HOST=${NGINX_UPSTREAM_HOST:-127.0.0.1}
62- export NGINX_UPSTREAM_PORT=${NGINX_UPSTREAM_PORT:-3000}
61+ export NGINX_STATIC_ROOT=${NGINX_STATIC_ROOT:-/var/www/html}
6362EOF
6463}
6564
@@ -173,50 +172,19 @@ EOM
173172EOM
174173}
175174
176- # ---------------------------------------------------------------------------------------
177- # nginx_legacy_initialize_nodejs() - Set up Nginx configuration for NodeJS
178- #
179- # @global NGINX_* The NGINX_* environment variables
180- # @return void
181- #
182- nginx_legacy_initialize_nodejs () {
183- info " Nginx: Enabling site configuration for NodeJS ..."
184- cat > " ${NGINX_CONF_PATH} /sites-enabled/nodejs.conf" << -EOM
185- upstream nodejs {
186- server ${NGINX_UPSTREAM_HOST} :${NGINX_UPSTREAM_PORT} ;
187- keepalive 8;
188- }
189-
190- server {
191- listen *:8080 default_server;
192-
193- add_header Via '\$ hostname';
194-
195- location / {
196- proxy_set_header X-Real-IP \$ remote_addr;
197- proxy_set_header X-Forwarded-For \$ proxy_add_x_forwarded_for;
198- proxy_set_header Host \$ http_host;
199-
200- proxy_pass http://nodejs/;
201- proxy_redirect off;
202- }
203- }
204- EOM
205- }
206-
207175# ---------------------------------------------------------------------------------------
208176# nginx_legacy_initialize_static() - Set up Nginx configuration for a static site
209177#
210178# @global NGINX_* The NGINX_* environment variables
211179# @return void
212180#
213181nginx_legacy_initialize_static () {
214- info " Nginx: Enabling default site configuration ..."
182+ info " Nginx: Enabling static site configuration with root at ${NGINX_STATIC_ROOT} ..."
215183 cat > " ${NGINX_CONF_PATH} /sites-enabled/default.conf" << -EOM
216184server {
217185 listen *:8080 default_server;
218186
219- root /var/www/html ;
187+ root ${NGINX_STATIC_ROOT} ;
220188
221189 # deny files starting with a dot (having "/." in the path)
222190 location ~ /\\ . {
@@ -308,8 +276,6 @@ nginx_legacy_initialize() {
308276
309277 if [ " $BEACH_NGINX_MODE " == " Flow" ]; then
310278 nginx_legacy_initialize_flow
311- elif [ " $BEACH_NGINX_MODE " == " NodeJS" ]; then
312- nginx_legacy_initialize_nodejs
313279 else
314280 nginx_legacy_initialize_static
315281 fi
0 commit comments