-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
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
-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 ;;
ServerName $h
ServerAlias www.$h
DocumentRoot $root
+EOF
+ if $do_root_settings; then
+ cat >>$vhost_file <<EOF
<Directory $root>
Options -Indexes ${symlinkarg}FollowSymlinks
</Directory>
EOF
+ fi
if [[ $extra_settings ]]; then
cat -- $extra_settings >>$vhost_file
listen [::]:$port $ssl_arg;
EOF
fi
- cat >>$vhost_file <<EOF
+ if $do_root_settings; then
+ cat >>$vhost_file <<EOF
location $root {
autoindex off;
}
EOF
+ fi
if $ssl; then
cat >>$vhost_file <<EOF
ssl_certificate $cert_dir/fullchain.pem;