Сталкнулся с такой проблемой, не пойму почему так происходит.
Почему pma если в пути указать index.php то авторизация nginx не работает, если просто указать pma, то авторизация nginx работает.
такае же проблема и слокейшеном administrator. если без индексного файла ссылка то пароль от nginx спрашивается, если с индексным файлом то пароль не спрашивается.
Пример.
http://www.syte-s.com/pma/ пароль от nginx спрашивается.
http://www.syte-s.com/pma/index.php пароль не спрашивается.
В директории сайта создам симлинк pma на phpmyadmin.
виртуалхсот.
Код: Выделить всё
server {
listen 1.1.1.1:80;
server_name syte-s.com;
return 301 http://www.syte-s.com$request_uri;
}
server {
listen 1.1.1.1:80;
server_name www.syte-s.com;
root /usr/local/www/syte-s.com;
index index.php index.html index.htm default.html default.htm;
open_file_cache max=15024 inactive=60s;
open_file_cache_valid 300s;
open_file_cache_min_uses 2;
open_file_cache_errors on;
location / {
try_files $uri $uri/ /index.php?$args;
}
location ~* /(images|cache|media|logs|tmp)/.*\.(php|pl|py|jsp|asp|sh|cgi)$ {
return 403;
error_page 403 /403_error.html;
}
location ~ \.php$ {
fastcgi_pass unix:/tmp/www.sock;
fastcgi_index index.php;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
}
location ~* \.(ico|pdf|flv)$ {
expires 1y;
}
location ~* \.(js|css|png|jpg|jpeg|gif|swf|xml|txt)$ {
expires 30d;
}
location ~* ^/administrator {
# index index.php;
auth_basic "closed site";
auth_basic_user_file /usr/local/.htpasswd;
}
location ~* ^/administrator/(.*\.php)$ {
fastcgi_pass unix:/tmp/www.sock;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
}
location ~* ^/modules/mod_videopages/helper.php {
fastcgi_pass unix:/tmp/www.sock;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param PHP_ADMIN_VALUE "xcache.cacher=Off";
fastcgi_param PHP_ADMIN_VALUE "xcache.stat=Off";
fastcgi_param PHP_ADMIN_VALUE "xcache.optimizer=Off";
}
location /pma {
alias /usr/local/www/phpMyAdmin/;
index index.php;
auth_basic "closed site";
auth_basic_user_file /usr/local/.htpasswd;
}
location ~ ^/pma/(.+\.php)$ {
auth_basic "closed site";
auth_basic_user_file /usr/local/.htpasswd;
fastcgi_pass unix:/tmp/www.sock;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME /usr/local/www/phpMyAdmin/$1;
fastcgi_param DOCUMENT_ROOT /usr/local/www/phpMyAdmin;
fastcgi_param PHP_ADMIN_VALUE "xcache.cacher=Off";
fastcgi_param PHP_ADMIN_VALUE "xcache.stat=Off";
fastcgi_param PHP_ADMIN_VALUE "xcache.optimizer=Off";
}
location ~ /\.ht {
deny all;
}
}
Проблему решил так.
Аналогично и для локейшена администратор.
Код: Выделить всё
location /pma/ {
alias /usr/local/www/phpMyAdmin/;
index index.php;
auth_basic "closed site";
auth_basic_user_file /usr/local/.htpasswd;
location ~ \.php$ {
fastcgi_pass unix:/tmp/www.sock;
fastcgi_index index.php;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $request_filename;
fastcgi_ignore_client_abort off;
fastcgi_param PHP_ADMIN_VALUE "xcache.cacher=Off";
fastcgi_param PHP_ADMIN_VALUE "xcache.stat=Off";
fastcgi_param PHP_ADMIN_VALUE "xcache.optimizer=Off";
}
}