Skip to content

Instantly share code, notes, and snippets.

@RamazanBIYIK
Last active August 1, 2019 07:17
Show Gist options
  • Save RamazanBIYIK/61223ddd8a897094fd2f0a7153fbf5fa to your computer and use it in GitHub Desktop.
Save RamazanBIYIK/61223ddd8a897094fd2f0a7153fbf5fa to your computer and use it in GitHub Desktop.
NGINX- Add username and password to nginx
Apache htpasswd generator indir.
Bir .htpasswd dosyası generate et.
location / {
# stub_status on;
#auth_basic "Kısıtlı alan";
#auth_basic_user_file /etc/nginx/htpasswd/.htpasswd;
#Eğer yukardaki 2 satırı aktif yaparsan şifreleme(özünde hashing) aktif oluyor.
#Yeni kullanıcı ve şifre tanımlamak için: htpasswd -c /etc/nginx/htpasswd/.htpasswd kullanıcıadi
#Bir yukarıdaki komut .htpasswd dosyasında ismine ve şifrene göre hashing yapıyor. Burada hash kodunu görebilirsin.
# Bu MD5 (apc) ye göre yapılıyor. Bildiğin md5 değil. Bunu kullanmak için browsera kullanıcı adı ve şifresini yolla. Kendin hashlemeye çalışma.
# First attempt to serve request as file, then
# as directory, then fall back to displaying a 404.
try_files $uri $uri/ =404 $uri/Ptest $uri/Ptest/ $uri/Ptest/* *.jpg =404;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment