changeset 2147:515e892cd4c2 nginx_decoupled tip

set nginx error log; rename luanhost_controller
author Violet7
date Wed, 21 Jan 2026 21:57:07 -0800
parents 2bc779c2451d
children
files host/gen_nginx.sh host/startup/nginx/9990-luanhost_controller.conf.luan host/startup/nginx/luanhost_controller.conf.luan host/startup/nginx/nginx_master.conf.luan
diffstat 4 files changed, 36 insertions(+), 27 deletions(-) [+]
line wrap: on
line diff
--- a/host/gen_nginx.sh	Wed Jan 21 20:15:11 2026 -0800
+++ b/host/gen_nginx.sh	Wed Jan 21 21:57:07 2026 -0800
@@ -15,7 +15,7 @@
 
 cp startup/nginx/mime.types $NGINX_ROOT_CONFIG_DIR
 luan startup/nginx/nginx_master.conf.luan $NGINX_ROOT_CONFIG_DIR $NGINX_SITE_CONFIGS_DIR $NGINX_LOG_DIR $NGINX_PID_DIR $NGINX_USER $NGINX_GROUP >$NGINX_ROOT_CONFIG_FILE
-luan startup/nginx/luanhost_controller.conf.luan $LUANHOST_DIR >"$NGINX_SITE_CONFIGS_DIR/luanhost_controller.conf"
+luan startup/nginx/9990-luanhost_controller.conf.luan $LUANHOST_DIR >"$NGINX_SITE_CONFIGS_DIR/9990-luanhost_controller.conf"
 
 # DON'T put this in the auto-loaded configs dir (NGINX_SITE_CONFIGS_DIR),
 # it is only meant to be loaded as part of a server block.
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/host/startup/nginx/9990-luanhost_controller.conf.luan	Wed Jan 21 21:57:07 2026 -0800
@@ -0,0 +1,34 @@
+local luanhostDir = ...
+
+%>
+	# IMPORTANT:
+	# directives outside `server` blocks are applied directly to the
+	# `http` block that this file is `include`d in. all these directives
+	# will apply to luanhost *AND* everything `include`d after it.
+	# this file name is preceded with `9990` so the glob expansion
+	# loads it towards the end of the list.
+
+	proxy_cache_path /usr/local/nginx_cache levels=1:2 keys_zone=nginx_cache:60m max_size=10g inactive=60m use_temp_path=off;
+	error_log <%=luanhostDir%>/logs/nginx_error.log warn;
+
+	server {
+		# ensure no other default_server exists!
+		# nginx usually has one at /etc/nginx/sites-enabled/default
+		listen 80 default_server;
+		listen [::]:80 default_server;
+		# DON'T put this in the auto-loaded configs dir,
+		# it is not meant to be loaded on its own.
+		include <%=luanhostDir%>/local/luanhost_default_site.conf;
+
+		location /.well-known/acme-challenge/ {
+			# $host/ssl does not exist for non-ssl sites and requests to here
+			# will fail with 404 for those sites, which is what we want
+			alias <%=luanhostDir%>/sites/$host/ssl/acme-challenge/;
+			try_files $uri $uri/ =404;
+		}
+	}
+
+	# glob pattern returns no results for site dirs that don't have 
+	# the ssl/ subdir, so this is ok
+	include <%=luanhostDir%>/sites/*/ssl/nginx.ssl.conf;
+<%
--- a/host/startup/nginx/luanhost_controller.conf.luan	Wed Jan 21 20:15:11 2026 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,25 +0,0 @@
-local luanhostDir = ...
-
-%>
-	proxy_cache_path /usr/local/nginx_cache levels=1:2 keys_zone=nginx_cache:60m max_size=10g inactive=60m use_temp_path=off;
-	server {
-		# ensure no other default_server exists!
-		# nginx usually has one at /etc/nginx/sites-enabled/default
-		listen 80 default_server;
-		listen [::]:80 default_server;
-		# DON'T put this in the auto-loaded configs dir,
-		# it is not meant to be loaded on its own.
-		include <%=luanhostDir%>/local/luanhost_default_site.conf;
-
-		location /.well-known/acme-challenge/ {
-			# $host/ssl does not exist for non-ssl sites and requests to here
-			# will fail with 404 for those sites, which is what we want
-			alias <%=luanhostDir%>/sites/$host/ssl/acme-challenge/;
-			try_files $uri $uri/ =404;
-		}
-	}
-
-	# glob pattern returns no results for site dirs that don't have 
-	# the ssl/ subdir, so this is ok
-	include <%=luanhostDir%>/sites/*/ssl/nginx.ssl.conf;
-<%
--- a/host/startup/nginx/nginx_master.conf.luan	Wed Jan 21 20:15:11 2026 -0800
+++ b/host/startup/nginx/nginx_master.conf.luan	Wed Jan 21 21:57:07 2026 -0800
@@ -9,7 +9,7 @@
 user <%=nginxUser%> <%=nginxGroup%>;
 worker_processes auto;
 pid <%=nginxPidDir%>/nginx.pid;
-error_log <%=nginxLogDir%>/error.log;
+error_log <%=nginxLogDir%>/error.log warn;
 # Entirely untested, uncomment if modules are needed
 # include <%=nginxRootConfigDir%>/modules/*.conf;