comparison host/update2.sh @ 2133:c3b4c19f2d8a

attempt to autodetect and use nginx confs dir
author Violet7
date Fri, 16 Jan 2026 17:29:05 -0800
parents 6a2383baecb6
children de3107eb911f
comparison
equal deleted inserted replaced
2132:44f47df52976 2133:c3b4c19f2d8a
11 if [ ! -f local/tiny_account.key ]; then 11 if [ ! -f local/tiny_account.key ]; then
12 echo "Register letsencrypt (tiny-acme)" 12 echo "Register letsencrypt (tiny-acme)"
13 openssl genrsa 4096 >local/tiny_account.key 13 openssl genrsa 4096 >local/tiny_account.key
14 fi 14 fi
15 15
16 nginx_conf_dir=$(
17 for d in \
18 /usr/local/etc/nginx/servers \
19 /etc/nginx/conf.d; do
20 if [ -d "$d" ]; then
21 echo "$d"
22 break
23 fi
24 done
25 )
26
27 if [ -n "$nginx_conf_dir" ]; then
28 echo "using nginx conf dir: $nginx_conf_dir"
29 else
30 echo "ERROR: No nginx conf dir found.\nFind it and add it to update2.sh."
31 exit 1
32 fi
33
16 # id -gn gets the name of the primary group of the current user (staff) 34 # id -gn gets the name of the primary group of the current user (staff)
17 luan startup/nginx/nginx.conf.luan $(pwd) $(whoami) $(id -gn) >local/nginx.conf 35 luan startup/nginx/nginx.conf.luan $(pwd) $nginx_conf_dir $(whoami) $(id -gn) | sudo tee $nginx_conf_dir/luanhost.conf >/dev/null
18 luan startup/nginx/nginx.default.conf.luan $(pwd) >local/nginx.default.conf 36 luan startup/nginx/nginx.default.conf.luan $(pwd) | sudo tee $nginx_conf_dir/luanhost.default.conf >/dev/null
19 37
20 # this is done because the nginx conf uses absolute paths 38 # this is done because the nginx conf uses absolute paths
21 # and this breaks sites when the luan/host directory is moved 39 # and this breaks sites when the luan/host directory is moved
22 # NOTE: if the luanhost root dir changes, the nginx include needs to be manually updated to reflect the new path.
23 luan classpath:luan/host/update.luan 40 luan classpath:luan/host/update.luan
24 41
25 echo Starting... 42 echo Starting...
26 ./start.sh 43 ./start.sh