Created
August 4, 2017 00:24
-
-
Save alexishida/161ab4dcd34b215127f394237bd5d341 to your computer and use it in GitHub Desktop.
http Basic Auth nginx
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
| sudo sh -c "echo -n 'usuario:' >> /etc/nginx/.htpasswd" | |
| sudo sh -c "openssl passwd senha >> /etc/nginx/.htpasswd" | |
| cat /etc/nginx/.htpasswd | |
| # Config do nginx | |
| 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; | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment