Created
April 13, 2018 17:54
-
-
Save rslhdyt/c0426fa9371c2f0abec84a1425e826d6 to your computer and use it in GitHub Desktop.
Basic Auth Nginx configuration
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# create encrypted password | |
# sudo sh -c "echo -n 'fpp:' >> /etc/nginx/.htpasswd" | |
# sudo sh -c "openssl passwd bar >> /etc/nginx/.htpasswd" | |
foo:BKlWoa/TUkUgc |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
server { | |
listen 80 default_server; | |
listen [::]:80 default_server ipv6only=on; | |
root /var/www/html; | |
index index.html index.htm; | |
server_name example.com; | |
location / { | |
try_files $uri $uri/ =404; | |
auth_basic "Restricted Content"; | |
auth_basic_user_file /etc/nginx/.htpasswd; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment