Skip to content

Commit

Permalink
Allow htpasswd to accept password from terminal and print it later on
Browse files Browse the repository at this point in the history
  • Loading branch information
gagan0123 committed Sep 3, 2019
1 parent 58ba175 commit 979b753
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion create_dev_site.sh
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ sed -i "s/GROUPNAME/$GROUPNAME/g" /etc/php/$PHPVERSION/fpm/pool.d/$POOLNAME.conf
#Creating new nginx config for the site
# @todo make option for creation of different types of sites like WordPress or PHP only
HTPASS=$(cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 30 | head -n 1)
htpasswd -c /etc/nginx/auth/$DOMAIN.htpasswd $USERNAME $HTPASS
htpasswd -bc /etc/nginx/auth/$DOMAIN.htpasswd $USERNAME $HTPASS
certbot certonly --webroot -w /var/www/letsencrypt -d $DOMAIN
cp /root/tools/shared_engine/templates/nginx-dev-php.conf /etc/nginx/sites-available/$DOMAIN
sed -i "s/DOMAINNAME/$DOMAIN/g" /etc/nginx/sites-available/$DOMAIN
Expand All @@ -45,3 +45,4 @@ chown -h www-data:www-data /var/www/$DOMAIN

service php$PHPVERSION-fpm reload
service nginx reload
echo "Password: $HTPASS"

0 comments on commit 979b753

Please sign in to comment.