Skip to content

Instantly share code, notes, and snippets.

@saissemet
Last active March 2, 2021 09:51
Show Gist options
  • Save saissemet/00b0a44237326bb50a1948dcc731d61a to your computer and use it in GitHub Desktop.
Save saissemet/00b0a44237326bb50a1948dcc731d61a to your computer and use it in GitHub Desktop.
## We'll be creating and protecting a new website folder named "private" with the user "saissemet". ##
sudo mkdir /var/www/html/private
sudo echo 'saissemet' >> /var/www/html/private/index.html
sudo nano /etc/nginx/sites-available/default
location /private/ {
auth_basic "Restricted";
auth_basic_user_file /etc/nginx/.htpasswd1;
}
sudo htpasswd -c /etc/nginx/.htpasswd1 saissemet
sudo systemctl restart nginx
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment