nginx: auth_basic ve php

0 Cevap php

i auth_basic kullanarak bir şifre ile web siteme bir klasör korumak istiyorum. Bu klasör istendiği takdirde idam edilmelidir php komut içerir.

Ben şu çalıştı:

location /admin {
  auth_basic    "Admin-Section";
  auth_basic_user_file /myfolder/.htpasswd;
 }

 location ~ ^/admin/.*\.php$ {
  auth_basic    "Admin-Section";
  auth_basic_user_file /myfolder/.htpasswd;
  fastcgi_pass 127.0.0.1:9000;
  fastcgi_index index.php;
  fastcgi_param SCRIPT_FILENAME  $document_root$fastcgi_script_name;
  include   fastcgi_params;
 }

Bu admin klasöründe php-script isterken kullanıcı adı / parola sorulur, ancak php-scriptler her zaman indirilen yerine fastcgi üzerinden yürütülecek.

Ben yanlış ne yapıyorum?

EDIT: On my local machine everything works fine with this configuration. o0
EDIT: BTW, php is working outside the admin-folder with the same fastcgi-options.
EDIT: OMG! The site's config was stored at /etc/nginx/sites-available/mysite and /etc/nginx/sites-enabled/ contained a symlink to the mysite-file. Since some time changing the mysite-file had no effect. E.g. changing all locations to "deny all" had no effect. The files were sent without a problem.
So i removed the symlink and restarted the server. Then i created the symlink again, restarted the server and everything works as expected. Can someone explain the odd behaviour?

Gest regards,
Biggie

0 Cevap