From f2e291926e0c2094cfda82e2a2acc996e48e0216 Mon Sep 17 00:00:00 2001 From: Ian Kelling Date: Mon, 18 Dec 2023 16:06:25 -0500 Subject: [PATCH] more flexible on document root settings --- web-conf | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/web-conf b/web-conf index 38dce52..0e06cdf 100755 --- a/web-conf +++ b/web-conf @@ -51,7 +51,8 @@ EXTRA_SETTINGS_FILE can be - for stdin -i Insecure, no ssl. -p PORT Main port to listen on, default 443. 80 implies -i. -r DIR DocumentRoot --s Allow symlinks from the doucmentroot +-s Allow symlinks from the doucment root +-t No settings on documentroot. -h|--help Print help and exit Note: Uses GNU getopt options parsing style @@ -65,7 +66,8 @@ symlinkarg=- ssl=true extra_settings= port=443 -temp=$(getopt -l help a:c:e:if:p:r:sh "$@") || usage 1 +do_root_settings=true +temp=$(getopt -l help a:c:e:if:p:r:sth "$@") || usage 1 vhostip='*' eval set -- "$temp" while true; do @@ -80,6 +82,7 @@ while true; do -i) ssl=false; shift ;; -p) port="$2"; shift 2 ;; -r) root="$2"; shift 2 ;; + -t) do_root_settings=false; shift ;; -s) symlinkarg=+; shift ;; --) shift; break ;; -h|--help) usage ;; @@ -202,10 +205,14 @@ if [[ $t == apache2 ]]; then ServerName $h ServerAlias www.$h DocumentRoot $root +EOF + if $do_root_settings; then + cat >>$vhost_file < Options -Indexes ${symlinkarg}FollowSymlinks EOF + fi if [[ $extra_settings ]]; then cat -- $extra_settings >>$vhost_file @@ -403,11 +410,13 @@ EOF listen [::]:$port $ssl_arg; EOF fi - cat >>$vhost_file <>$vhost_file <>$vhost_file <