Skip to content

Commit 65be06d

Browse files
authored
Nginx vhost ssl letsencrypt
1 parent 4cb95a9 commit 65be06d

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

nginx-vhost.sh

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,10 @@ server {
4242
default_type "text/plain";
4343
try_files \$uri =404;
4444
}
45-
# Redirect ssl
46-
return 301 https://${TO_HOST}\$request_uri;
45+
location / {
46+
# Redirect ssl
47+
return 301 https://${TO_HOST}\$request_uri;
48+
}
4749
}
4850
" > "/etc/nginx/sites-enabled/${DOMAIN}.conf"
4951

@@ -127,6 +129,7 @@ sudo mkdir -p "/var/www/${DOMAIN}/public/.well-known/acme-challenge"
127129
# Add index page
128130
echo "Html Works ..." > "/var/www/${DOMAIN}/public/index.html"
129131
echo "<?php echo 'Php Works ...';" > "/var/www/${DOMAIN}/public/index.php"
132+
echo "Webroot certs ..." > "/var/www/${DOMAIN}/public/.well-known/acme-challenge/index.html"
130133

131134
# Chmods
132135
sudo chown -R www-data:www-data /etc/nginx/sites-enabled

0 commit comments

Comments
 (0)