Skip to content

gorsaribekyan/nginx_basic_authentication

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 

Repository files navigation

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.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published