${uri}index.php causing error

Morning!

I’ve searched the wiki for this issue and I wasn’t able to solve it,
can anyone help?

I’m assuming nginx is getting lost with the {} on ${uri}…

This line

try_files $uri.php ${uri}index.php =404;

Is giving me this error:

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

If I remove “${uri}index.php” then it starts fine. This is the context:

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;
}

Thanks in advance

Leonardo

Hello!

On Thu, Apr 08, 2010 at 09:08:25AM +1000, Leonardo C. wrote:

Is giving me this error:

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

  • try_files $uri.php ${uri}index.php =404;
  • try_files $uri.php “${uri}index.php” =404;

Curly brackets aren’t allowed outside quoted strings as they
denote configuration blocks.

Maxim D.

G’day mate!

Curly brackets aren’t allowed outside quoted strings as they
denote configuration blocks.

Ah that’s why! So can I use either one of the 2 options? Care to
explain the - and + signs in front of try_files? They’re not on the
wiki too.

Cheers!

Leo

Ah that’s why! So can I use either one of the 2 options? Care to
explain the - and + signs in front of try_files? They’re not on the
wiki too.

It is not configuration option but rather how you make the ‘diff’:

  • remove the line
  • replace the line with this

:slight_smile:

rr

Hello!

On Thu, Apr 08, 2010 at 08:55:38PM +1000, Leonardo C. wrote:

G’day mate!

Curly brackets aren’t allowed outside quoted strings as they
denote configuration blocks.

Ah that’s why! So can I use either one of the 2 options? Care to
explain the - and + signs in front of try_files? They’re not on the
wiki too.

“-” and “+” are from unified diff(1) fromat. You have to remove
first line and add second instead (with quotes added).

[…]

  • try_files $uri.php ${uri}index.php =404;
  • try_files $uri.php “${uri}index.php” =404;

Maxim D.

:smiley:

Cheers mate!