Skip to content

Commit

Permalink
Nginx vhost ssl letsencrypt
Browse files Browse the repository at this point in the history
  • Loading branch information
atomjoy authored Jan 24, 2023
1 parent 4cb95a9 commit 65be06d
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions nginx-vhost.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand Down Expand Up @@ -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 "<?php echo 'Php Works ...';" > "/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
Expand Down

0 comments on commit 65be06d

Please sign in to comment.