Last active
April 7, 2017 19:31
-
-
Save khaledsaikat/fbe31939f3db6880feec0e3017344221 to your computer and use it in GitHub Desktop.
Some nginx config inside server block: Using subdirectory, Server from another directory, Autoindex file listing, Using basic auth
This file contains 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
## | |
# Some nginx config inside server block | |
# | |
# Examples of: | |
# * Using subdirectory | |
# * Server from another directory | |
# * Autoindex file listing | |
# * Using basic auth | |
# | |
# Install and using of htpasswd tools: | |
# sudo apt-get install apache2-utils | |
# sudo htpasswd -c /etc/nginx/.htpasswd sammy | |
## | |
location /logs/ { | |
try_files $uri $uri/ =404; | |
# Using as root directory | |
alias /var/www/logs; | |
# File listing | |
autoindex on; | |
# Basic auth | |
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