我已经configurationnginx使用auth_basic来密码保护一个目录。 密码提示出现,login工作正常。
但是,如果我拒绝键入我的凭据,而是连续多次命中转义,页面将最终加载W / O CSS和图像。
换句话说,连续告诉login提示消失将在某个时候允许页面加载。
这是nginx,或我的configuration问题?
这是我的虚拟主机:
31 server { 32 server_name sub.domain.com; 33 root /www/sub.domain.com/; 34 35 location / { 36 index index.php index.html; 37 root /www/sub.domain.com; 38 auth_basic "Restricted"; 39 auth_basic_user_file /www/auth/sub.domain.com; 40 error_page 404 = /www/404.php; 41 } 42 43 location ~ \.php$ { 44 include /usr/local/nginx/conf/fastcgi_params; 45 } 46 }
我的服务器运行CentOS + nginx + php-fpm + xcache + mysql
你的configuration,nginx将只使用最具体的位置块。 所以,当你请求一个* .php文件时,它将使用位置〜.php $块,而不是看到auth基本configuration。
.css,.js等文件的工作原因是因为这些文件与PHP位置块不匹配
您将需要将您的auth基本configuration添加到php文件位置块。