Nginx 1.7.0: location @php

TECK nginx-forum at nginx.us
Sun May 25 09:49:33 UTC 2014


Hi all,

I'm trying to understand why the use of this configuration code does not
work:
location ^~ /setup {
	auth_basic                      "Restricted Access";
	auth_basic_user_file            htpasswd;
	try_files                       $uri $uri/ /setup/index.php?$uri&$args;
	location ~ \.php$ {
		try_files               @php =404;
	}
}
location @php {
	try_files                       $uri =404;
	fastcgi_split_path_info         ^(.+\.php)(/.+)$;
	fastcgi_pass                    fastcgi;
	fastcgi_param                   PATH_INFO       $fastcgi_path_info;
	fastcgi_param                   PATH_TRANSLATED
$document_root$fastcgi_script_name;
	include                         fastcgi.conf;
}

This works:
location ^~ /setup {
	auth_basic                      "Restricted Access";
	auth_basic_user_file            htpasswd;
	try_files                       $uri $uri/ /setup/index.php?$uri&$args;
	location ~ \.php$ {
		try_files               $uri =404;
		fastcgi_split_path_info ^(.+\.php)(/.+)$;
		fastcgi_pass            fastcgi;
		fastcgi_param           PATH_INFO       $fastcgi_path_info;
		fastcgi_param           PATH_TRANSLATED
$document_root$fastcgi_script_name;
		include                 fastcgi.conf;
	}
}

Thank you for your help.

Posted at Nginx Forum: http://forum.nginx.org/read.php?2,250342,250342#msg-250342



More information about the nginx mailing list