【发布时间】:2017-11-18 11:41:37
【问题描述】:
我已经将我的 Nginx 服务器设置为对所有内容进行身份验证,但我想排除 /var/www/html/t/sms/plivo 下的所有文件以进行密码身份验证。我尝试过使用不同的路径,但是当我尝试从浏览器访问/var/www/html/t/sms/plivo 下的文件时,它总是要求输入密码。
下面是我的/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;
}
}
【问题讨论】:
标签: ubuntu nginx debian-based