Requests ending with / (slash) are returning 404

Leonardo Crespo leo at leocrespo.com
Wed Apr 7 15:05:51 MSD 2010


When i put this

location ~ ^/portal/admin/.*\.php$ {
		fastcgi_pass 127.0.0.1:9000;
		fastcgi_intercept_errors on;
		fastcgi_index index.php;
		include /usr/local/nginx/conf/fastcgi_params;
		fastcgi_param SCRIPT_FILENAME
/home/public_html/domain.com.au/public/$fastcgi_script_name;
	}

i get this error:

Starting nginx: [emerg]: directive "try_files" is not terminated by
";" in /usr/local/nginx/sites-enabled/domain.com.au:26

line 26 is this: try_files $uri.php ${uri}index.php =404;

When i remove this:

location ~ ^/portal/admin/.*\.php$ {
		fastcgi_pass 127.0.0.1:9000;
		fastcgi_intercept_errors on;
		fastcgi_index index.php;
		include /usr/local/nginx/conf/fastcgi_params;
		fastcgi_param SCRIPT_FILENAME
/home/public_html/boysdownunder.com.au/public/$fastcgi_script_name;
	}


The error dissapears.... No idea what's going on as one thing should
affect the other and the error message is wrong, as I'm definitely
ending the statement with a ;



On Wed, Apr 7, 2010 at 8:47 PM, Edho P Arief <edhoprima at gmail.com> wrote:
> On Wed, Apr 7, 2010 at 5:40 PM, Leonardo Crespo <leo at leocrespo.com> wrote:
>> I'd to enable the php extension (/foo/page.php)  when the url is
>> domain.com.au/portal/admin*
>>
>> Here's my failed attempt and the error I'm getting. I'll make sure to
>> keep reading as much as possible and not to ask questions that are
>> already answered.
>>
>> -------------------
>> location / {
>>        try_files $uri @php;
>> }
>> location @php {
>>        try_files $uri.php ${uri}index.php =404;
>>
>>        fastcgi_pass 127.0.0.1:9000;
>>        fastcgi_intercept_errors on;
>>        fastcgi_index index.php;
>>        include /usr/local/nginx/conf/fastcgi_params;
>>        fastcgi_param SCRIPT_FILENAME
>> /home/public_html/domain.com.au/public/$fastcgi_script_name;
>> }
>>
>> location ~ \.php$ {
>> #if the uri is not /portal/admin, return 404, disabling the php
>> extension on the rest of the site
>>        if (!$uri ~* /portal/admin) {
>>                return 404;
>>        }
>> }
>> -----------------
>> Starting nginx: [emerg]: invalid condition "!$request_uri" in
>> /usr/local/nginx/sites-enabled/domain.com.au:37
>>
>
> location ~ \.php$ {
>  return 404;
> }
> location ~ ^/portal/admin/.*\.php$ {
>  ...fastcgi stuff...
> }
>
>> Not sure if the syntax is valid and also if I'm putting it in the
>> right place as to avoid conflict with fastcgi.
>>
>
>
> --
> O< ascii ribbon campaign - stop html mail - www.asciiribbon.org
>
> _______________________________________________
> nginx mailing list
> nginx at nginx.org
> http://nginx.org/mailman/listinfo/nginx
>



More information about the nginx mailing list