Skip to content

Latest commit

 

History

History
43 lines (30 loc) · 561 Bytes

README.md

File metadata and controls

43 lines (30 loc) · 561 Bytes

Nginx with Basic Authentication

  • Install NGINX.
sudo apt install nginx
  • Install Apache2 Utils.
sudo apt install apache2-utils
  • Setup user credential into .htpasswd file.
htpasswd -c /etc/nginx/.htpasswd <user>
  • Open default config file with nano.
nano /etc/nginx/sites-available/default
  • Add this.
location /admin {
    try_files $uri $uri/ =404;
    auth_basic "Admin page.";
    auth_basic_user_file /etc/nginx/.htpasswd
}
  • Restart NGINX server.
sudo systemctl restart nginx

All done.