diff --git a/createVhosts.sh b/createVhosts.sh index 6add417..8a08da3 100755 --- a/createVhosts.sh +++ b/createVhosts.sh @@ -25,19 +25,9 @@ function usage exit 0 } -function stop_nginx -{ - systemctl stop nginx -} - -function start_nginx -{ - systemctl start nginx -} - function get_cert { - /root/.acme.sh/acme.sh --issue --domain $_domain --standalone --cert-file /etc/nginx/ssl/${_domain}.crt --key-file /etc/nginx/ssl/${_domain}.key --fullchain-file /etc/nginx/ssl/${_domain}-fullchain.crt + /root/.acme.sh/acme.sh --issue --domain $_domain --webroot /srv/http-content-combined/ --cert-file /etc/nginx/ssl/${_domain}.crt --key-file /etc/nginx/ssl/${_domain}.key --fullchain-file /etc/nginx/ssl/${_domain}-fullchain.crt } _cwd="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" @@ -124,6 +114,15 @@ fi echo "Creating Nginx configuration..." _vhost_conf_file=/etc/nginx/conf.d/${_domain}.conf + +echo -n "Checking if /srv/http-content-combined/ exists?" +if ! test -d /srv/http-content-combined; then + echo " Creating..." + mkdir -p /srv/http-content-combined/ +else + echo " Yes!" +fi + cat << EOF > $_vhost_conf_file #### Description ## Type: HTTP @@ -134,6 +133,7 @@ server { server_name $_domain; location /.well-known { + root /srv/http-content-combined/; autoindex on; } @@ -162,11 +162,5 @@ EOF echo "Setting permissions on conf file..." #setfacl -m user:sysadmin:rw $_vhost_conf_file -echo "Stopping Nginx..." -#stop_nginx - echo "Retrieving Let's Encrypt Certificate..." -#get_cert - -echo "Starting Nginx..." -#start_nginx +get_cert