Вопрос по location

bas bas at it-core.org
Tue Oct 27 22:07:51 MSK 2009


Добрый вечер!

Есть примерно такой конфиг:

server {
listen 80;
server_name www.ru;
charset utf8;

root /usr/local/www/www.ru;

location ~ /\.ht {
deny all;
}
location / {
index index.php index.html;
allow 192.168.0.10;
deny all;
}
location /someloc/ {
autoindex on;
auth_basic "Login";
auth_basic_user_file /usr/local/www/www.ru/someloc/.htpasswd;
}
location ~ ^/someloc/(.*\.php)$ {
fastcgi_pass unix:/tmp/php.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root/someloc/$1;
include fastcgi_params;

auth_basic "Login";
auth_basic_user_file /usr/local/www/www.ru/someloc/.htpasswd;
}
location ~ \.php$ {
allow 192.168.0.10;
deny all;

fastcgi_pass unix:/tmp/php.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME /usr/local/www/www.ru$fastcgi_script_name;
include fastcgi_params;
fastcgi_param DOCUMENT_ROOT /usr/local/www/www.ru;
}
}

Можно ли в данном случае как-то модифицировать описание location, чтобы
allow/deny и auth прописывать только в одной location (т.е. чтобы для
php-скриптов не приходилось дублировать)?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://nginx.org/pipermail/nginx-ru/attachments/20091028/4eaf9740/attachment.html>


More information about the nginx-ru mailing list