1
我已經設置了我的Nginx服務器以對所有內容進行身份驗證,但是我想排除/var/www/html/t/sms/plivo
之下的所有文件以進行密碼驗證。我試過使用不同的路徑,但當我嘗試從我的瀏覽器訪問/var/www/html/t/sms/plivo
下的文件時,它總是要求輸入密碼。從Nginx密碼驗證中排除一個目錄
下面是我的/etc/nginx/sites-available/default
文件
server {
listen 80 default_server;
listen [::]:80 default_server;
root /var/www/html;
index index.php index.html index.htm index.nginx-debian.html;
server_name _;
auth_basic "Private Property";
auth_basic_user_file /etc/nginx/.htpasswd;
#no password for the plivo folder so we can recieve messages!
location = /t/sms/plivo/ {
auth_basic off;
allow all; # Allow all to see content
}
location/{
try_files $uri $uri/ =404;
}
location ~ \.php$ {
include snippets/fastcgi-php.conf;
fastcgi_pass unix:/run/php/php7.0-fpm.sock;
}
location ~ /\.ht {
deny all;
}
}