Skip to content

Instantly share code, notes, and snippets.

@evemilano
Created May 24, 2017 20:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save evemilano/d6286076cfd7d1810d219bc487c2143d to your computer and use it in GitHub Desktop.
Save evemilano/d6286076cfd7d1810d219bc487c2143d to your computer and use it in GitHub Desktop.
Nginx Directory Password Protection - /etc/nginx/sites-enabled/default
server {
listen 80 default_server;
listen [::]:80 default_server ipv6only=on;
root /usr/share/nginx/html;
index index.html index.htm;
server_name localhost;
location / {
try_files $uri $uri/ =404;
auth_basic "Restricted Content";
auth_basic_user_file /etc/nginx/.htpasswd;
}
}
@evemilano
Copy link
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment