【发布时间】:2014-07-21 21:38:44
【问题描述】:
我正在拔头发来解决这个问题。我的站点中有一个页面,它总是要求输入用户名和密码,就好像它受到限制一样,这里是page。我设置了对我的另一个域 here 的受限访问。这是我的 nginx 配置文件:
server {
listen 80;
server_name dev.shopious.com;
client_max_body_size 25M;
access_log /var/log/nginx/dev.shopious.com.access_log;
error_log /var/log/nginx/dev.shopious.com.error_log warn;
server_name_in_redirect off;
root /home/yanrizal/shopious-dev/web;
location / {
try_files $uri /app_dev.php?$args;
}
index app_dev.php index.php index.html;
fastcgi_index index.php;
location ~ \.php($|/) {
set $script $uri;
set $path_info "";
if ($uri ~ "^(.+\.php)(/.*)") {
set $script $1;
set $path_info $2;
}
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_param PATH_INFO $fastcgi_path_info;
fastcgi_param PATH_TRANSLATED $document_root$fastcgi_path_info;
include /etc/nginx/fastcgi_params;
keepalive_timeout 0;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_pass 127.0.0.1:9000;
}
auth_basic "Restricted";
auth_basic_user_file /etc/nginx/htpasswd;
location ~* \.(js|css)$ {
expires 1d;
log_not_found off;
}
location ~* \.(png|jpg|jpeg|gif|ico)$ {
expires 1y;
log_not_found off;
}
}
为什么如果我删除此配置文件上的限制,它也会解决此特定页面上的限制问题?此站点上的所有其他页面均不受限制,仅此特定页面
【问题讨论】: