From 65be06dde6d0603fad98329166a5ee74551946cc Mon Sep 17 00:00:00 2001 From: Atomjoy Date: Tue, 24 Jan 2023 15:22:54 +0100 Subject: [PATCH] Nginx vhost ssl letsencrypt --- nginx-vhost.sh | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/nginx-vhost.sh b/nginx-vhost.sh index 0728cae..21323ab 100644 --- a/nginx-vhost.sh +++ b/nginx-vhost.sh @@ -42,8 +42,10 @@ server { default_type "text/plain"; try_files \$uri =404; } - # Redirect ssl - return 301 https://${TO_HOST}\$request_uri; + location / { + # Redirect ssl + return 301 https://${TO_HOST}\$request_uri; + } } " > "/etc/nginx/sites-enabled/${DOMAIN}.conf" @@ -127,6 +129,7 @@ sudo mkdir -p "/var/www/${DOMAIN}/public/.well-known/acme-challenge" # Add index page echo "Html Works ..." > "/var/www/${DOMAIN}/public/index.html" echo " "/var/www/${DOMAIN}/public/index.php" +echo "Webroot certs ..." > "/var/www/${DOMAIN}/public/.well-known/acme-challenge/index.html" # Chmods sudo chown -R www-data:www-data /etc/nginx/sites-enabled