Nginx-ru mailing list archive (nginx-ru@sysoev.ru)
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: basic авторизация - как пра вильно?
- To: nginx-ru@xxxxxxxxx
- Subject: Re: basic авторизация - как пра вильно?
- From: "User" <nginx-forum@xxxxxxxx>
- Date: Fri, 17 Dec 2010 21:38:11 -0500
- Dkim-signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=mickey.jlkhosting.com; s=x; h=Sender:From:References:In-Reply-To:Message-ID:Content-Transfer-Encoding:Content-Type:Subject:To:Date; bh=jQ1b3f3AwjrVhG6Efu0eJBnT3L0jNKeseP1aDfWn+Nc=; b=XxGEYqQd9U3VRpVQj1+ZkpAX72oaw2LfllKF+zNr5VsTGCzA5NpL1757b2oGtgsN/2OkdLsr1NXjlwevo1bUTimjR4hwds8GGID1V0cluTcqfuMi2HEq49VjCCjV38gR;
- In-reply-to: <20101214113453.GG79447@xxxxxxxxxxxxx>
- References: <20101214113453.GG79447@xxxxxxxxxxxxx>
Блин, что-то я всё-такие делаю не так -
вложил location'ы как советовали, в итоге в
/protected все работает хорошо, а в / php
отдаётся исходником.
Из вариантов только вкладывать location'ы
php везде - вроде бы должно работать, но
как-то некрасиво...
nginx 0.9.3, ниже полная часть 'server' конфига
server
{
listen 8080;
server_name domain.com;
access_log /home/user/logs/domain.com/access_log combined;
error_log /home/user/logs/domain.com/error_log;
location /
{
root /home/user/sites/domain.com;
}
if ($host = 'www.domain.com')
{
rewrite ^(.*)$ http://domain.com$1 permanent;
}
location /protected
{
auth_basic "Protected";
auth_basic_user_file /home/user/etc/.htpasswd;
#root /home/user/sites/domain.com/protected;
location ~ \.php$
{
fastcgi_pass unix:/home/user/tmp/phpfpm.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME
/home/user/sites/domain.com$fastcgi_script_name;
fastcgi_param QUERY_STRING $query_string;
fastcgi_param REQUEST_METHOD $request_method;
fastcgi_param CONTENT_TYPE $content_type;
fastcgi_param CONTENT_LENGTH $content_length;
fastcgi_param SCRIPT_NAME $fastcgi_script_name;
fastcgi_param REQUEST_URI $request_uri;
fastcgi_param DOCUMENT_URI $document_uri;
fastcgi_param DOCUMENT_ROOT $document_root;
fastcgi_param SERVER_PROTOCOL $server_protocol;
fastcgi_param GATEWAY_INTERFACE CGI/1.1;
fastcgi_param SERVER_SOFTWARE nginx/$nginx_version;
fastcgi_param REMOTE_ADDR $remote_addr;
fastcgi_param REMOTE_PORT $remote_port;
fastcgi_param SERVER_ADDR $server_addr;
fastcgi_param SERVER_PORT $server_port;
fastcgi_param SERVER_NAME $server_name;
}
}
location /php_status
{
include fastcgi_params;
fastcgi_pass unix:/home/user/tmp/phpfpm.sock;
fastcgi_param SCRIPT_FILENAME $fastcgi_script_name;
}
}
Posted at Nginx Forum:
http://forum.nginx.org/read.php?21,158476,159549#msg-159549
_______________________________________________
nginx-ru mailing list
nginx-ru@xxxxxxxxx
http://nginx.org/mailman/listinfo/nginx-ru
|