changeset 2134:de3107eb911f

improve previous
author Violet7
date Fri, 16 Jan 2026 17:59:40 -0800
parents c3b4c19f2d8a
children e94d10d071e4
files host/startup/nginx/nginx.conf.luan host/update2.sh src/luan/host/Https.luan
diffstat 3 files changed, 7 insertions(+), 20 deletions(-) [+]
line wrap: on
line diff
--- a/host/startup/nginx/nginx.conf.luan	Fri Jan 16 17:29:05 2026 -0800
+++ b/host/startup/nginx/nginx.conf.luan	Fri Jan 16 17:59:40 2026 -0800
@@ -7,7 +7,9 @@
 		# nginx usually has one at /etc/nginx/sites-enabled/default
 		listen 80 default_server;
 		listen [::]:80 default_server;
-		include <%=nginxConfigDir%>/nginx.default.conf;
+		# 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.conf;
 
 		location /.well-known/acme-challenge/ {
 			# $host/ssl does not exist for non-ssl sites and requests to here
--- a/host/update2.sh	Fri Jan 16 17:29:05 2026 -0800
+++ b/host/update2.sh	Fri Jan 16 17:59:40 2026 -0800
@@ -33,7 +33,9 @@
 
 # id -gn gets the name of the primary group of the current user (staff)
 luan startup/nginx/nginx.conf.luan $(pwd) $nginx_conf_dir $(whoami) $(id -gn) | sudo tee $nginx_conf_dir/luanhost.conf >/dev/null
-luan startup/nginx/nginx.default.conf.luan $(pwd) | sudo tee $nginx_conf_dir/luanhost.default.conf >/dev/null
+# DON'T put this in the auto-loaded configs dir,
+# it is not meant to be loaded on its own.
+luan startup/nginx/nginx.default.conf.luan $(pwd) >$(pwd)/local/luanhost.default.conf
 
 # this is done because the nginx conf uses absolute paths
 # and this breaks sites when the luan/host directory is moved
--- a/src/luan/host/Https.luan	Fri Jan 16 17:29:05 2026 -0800
+++ b/src/luan/host/Https.luan	Fri Jan 16 17:59:40 2026 -0800
@@ -28,22 +28,6 @@
 	local ssl_files_dir = site_dir.child("ssl/")
 	ssl_files_dir.mkdir()
 
-	local nginx_conf_paths {
-		"/usr/local/etc/nginx/servers",
-		"/etc/nginx/conf.d"
-	}
-    local real_nginx_confs_dir
-
-	for _,v in ipairs(nginx_conf_paths) do 
-		local dir = uri("file:"..v)
-		if v.is_directory() then
-			real_nginx_confs_dir = v
-			logger.info("using nginx confs dir "..v.canonical().to_string())
-			break
-		end
-		error("No nginx confs directory found. Manual intervention required.")
-	end
-
 	return {
 		ssl_files_dir = ssl_files_dir
 		nginx_file = ssl_files_dir.child("nginx.ssl.conf")
@@ -52,7 +36,6 @@
 		csr_file = ssl_files_dir.child(domain..".csr")
 		tmp_cert_out = ssl_files_dir.child(domain..".crt.tmp")
 		acme_challenges = ssl_files_dir.child("acme-challenge/")
-		nginx_confs_dir = real_nginx_confs_dir
 	}
 end
 
@@ -117,7 +100,7 @@
 		ssl_certificate <%= files.local_cer_file.to_string() %>;
 		ssl_certificate_key <%= files.key_file.to_string() %>;
 		# path is relative to the dir of the master nginx conf
-		include <%=nginx_confs_dir.canonical().to_string()%>/luanhost.default.conf;
+		include <%=luanhost_dir.canonical().to_string()%>/local/luanhost.default.conf;
 	}
 <%
 end