Welcome! Log In Create A New Profile

Advanced

nginx location single php file

May 16, 2013 05:35AM
Всем привет.
Нужно отключить basic авторизацию для запроса http://domain.com/rpc.php?jkfgsdkfg. Для всего сайта включена basic авторизация. Создаю новый location :

location ~ /rpc.php {
auth_basic off;
fastcgi_pass 127.0.0.1:9000;
fastcgi_param DOCUMENT_ROOT /www;
fastcgi_param SCRIPT_FILENAME /www$fastcgi_script_name;
fastcgi_param PATH_TRANSLATED /www$fastcgi_script_name;
fastcgi_param SCRIPT_NAME $fastcgi_script_name;
fastcgi_param QUERY_STRING $query_string;
fastcgi_param CONTENT_TYPE $content_type;
fastcgi_param CONTENT_LENGTH $content_length;
fastcgi_param SERVER_ADDR $server_addr;
fastcgi_param SERVER_PORT $server_port;
fastcgi_param SERVER_PROTOCOL $server_protocol;
fastcgi_param GATEWAY_INTERFACE "CGI/1.1";
fastcgi_param SERVER_NAME $server_name;
fastcgi_param REQUEST_URI $request_uri;
fastcgi_param REQUEST_METHOD $request_method;
fastcgi_param REMOTE_USER $remote_user;
fastcgi_param REMOTE_ADDR $remote_addr;
fastcgi_param REMOTE_PORT $remote_port;
fastcgi_param GEOIP_COUNTRY_CODE $geoip_city_country_code;
fastcgi_param GEOIP_COUNTRY_NAME $geoip_city_country_name;
fastcgi_param GEOIP_REGION $geoip_region;
fastcgi_param GEOIP_CITY $geoip_city;
}

Но не работает (то есть, всё равно требуется авторизация). Хотя вот такие location'ы вполне работают (то есть, при запросе http://domain.com/ajax/jfsgf.php?fhfsl - basic авторизация не запрашивается):

location /ajax {
auth_basic off;
alias /www/ajax;
}
location ~ /ajax/(.*\.php)$ {
auth_basic off;
fastcgi_pass 127.0.0.1:9000;
fastcgi_param DOCUMENT_ROOT /www;
fastcgi_param SCRIPT_FILENAME /www$fastcgi_script_name;
fastcgi_param PATH_TRANSLATED /www$fastcgi_script_name;
fastcgi_param SCRIPT_NAME $fastcgi_script_name;
fastcgi_param QUERY_STRING $query_string;
fastcgi_param CONTENT_TYPE $content_type;
fastcgi_param CONTENT_LENGTH $content_length;
fastcgi_param SERVER_ADDR $server_addr;
fastcgi_param SERVER_PORT $server_port;
fastcgi_param SERVER_PROTOCOL $server_protocol;
fastcgi_param GATEWAY_INTERFACE "CGI/1.1";
fastcgi_param SERVER_NAME $server_name;
fastcgi_param REQUEST_URI $request_uri;
fastcgi_param REQUEST_METHOD $request_method;
fastcgi_param REMOTE_USER $remote_user;
fastcgi_param REMOTE_ADDR $remote_addr;
fastcgi_param REMOTE_PORT $remote_port;
fastcgi_param GEOIP_COUNTRY_CODE $geoip_city_country_code;
fastcgi_param GEOIP_COUNTRY_NAME $geoip_city_country_name;
fastcgi_param GEOIP_REGION $geoip_region;
fastcgi_param GEOIP_CITY $geoip_city;
}

Не могу понять, почему запрашивается basic авторизация при запросе http://domain.com/rpc.php и как её отключить.
Уже по разному пробовал location менять:

location = /rpc.php
location /rpc.php

не работает.
Subject Author Posted

nginx location single php file

skeletor May 16, 2013 05:35AM

Re: nginx location single php file

Andrey Kopeyko May 16, 2013 05:54AM

Re: nginx location single php file

skeletor May 16, 2013 06:19AM

Re: nginx location single php file

Maxim Dounin May 16, 2013 07:12AM

Re: nginx location single php file

Dmitry Ivanov May 16, 2013 07:14AM

Re: nginx location single php file

skeletor May 16, 2013 07:45AM

Re: nginx location single php file

skeletor May 16, 2013 08:22AM

Re: nginx location single php file

Andrey Kopeyko May 16, 2013 01:16PM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 77
Record Number of Users: 6 on February 13, 2018
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready