-f $request_filename

Hello,

Got something like this, but the break seams to not work,
and the file is being processed by the php fastcgi process.

Any clue why?

location / {
if (-f $request_filename) {
root /vhosts/default/test;
break;
}

 try_files $uri $uri/ @fallback;
 fastcgi_pass unix:/var/run/spawn-fcgi.sock;
 fastcgi_param SCRIPT_FILENAME $document_root/$fastcgi_script_name;
 fastcgi_param APPLICATION_TYPE $app_type;
 fastcgi_param APP_LANG $app_lang;
 fastcgi_param SERVER_TYPE $server_type;
 fastcgi_param ENVIRONMENT test;
 include fastcgi_params;

}

On Mon, Apr 19, 2010 at 7:54 PM, Tomasz P. [email protected] wrote:

Hello,

Got something like this, but the break seams to not work,
and the file is being processed by the php fastcgi process.

Any clue why?

to put it short: (most likely) you’re doing it wrong.


O< ascii ribbon campaign - stop html mail - www.asciiribbon.org

Hello!

On Mon, Apr 19, 2010 at 02:54:41PM +0200, Tomasz P. wrote:

try_files $uri $uri/ @fallback;
fastcgi_pass unix:/var/run/spawn-fcgi.sock;

Wow. I wonder what you are trying to achieve…

Maxim D.

Hello,

Got something like this, but the break seams to not work,
and the file is being processed by the php fastcgi process.

Any clue why?

to put it short: (most likely) you’re doing it wrong
(most likely) you’re wasting bandwith with such comments

 }

 try_files $uri $uri/ @fallback;
 fastcgi_pass unix:/var/run/spawn-fcgi.sock;

Wow. I wonder what you are trying to achieve…

When requesting http://domain.tld/sitemap.xml the request should
got to the fastcgi process, because that needs to be generated from
application.

But when requesting other xml files it should use the files;

On Mon, Apr 19, 2010 at 05:25:12PM +0200, Tomasz P. wrote:

   break;

But when requesting other xml files it should use the files;

A generic method:

location / {
root /vhosts/default/test;
try_files $uri $uri/ @fallback;
}

location @fallback {
fastcgi_pass unix:/var/run/spawn-fcgi.sock;

}

Or always pass XML to fastcgi:

location / {
root /vhosts/default/test;
}

location ~ .xml$ {
fastcgi_pass unix:/var/run/spawn-fcgi.sock;

}


Igor S.
http://sysoev.ru/en/

On Tue, Apr 20, 2010 at 12:57 AM, Tomasz P. [email protected] wrote:

  …
$uri @fallback

probably because no index was defined and autoindex is disabled.


O< ascii ribbon campaign - stop html mail - www.asciiribbon.org

}

This seems to work, just one question.
The fastcgi application is Zend based, but i get an

403 forbiddened when try_files is:
$uri $uri/ @fallback

when i set it up to:
$uri @fallback

it seems to work, why is that?

On Mon, Apr 19, 2010 at 07:57:54PM +0200, Tomasz P. wrote:

 ...

it seems to work, why is that?

When you request “/”, “try_files $uri/” founds that there is
a directory “/vhosts/default/test/” and nginx uses “location /”
for handling the request. Then the directive “index” tries to
find its default value “index.html”. If it can not find it, this leads
to 403.

Probably, you need

location / {
root /vhosts/default/test;
try_files $uri $uri/ @fallback;
index index.php;
}


Igor S.
http://sysoev.ru/en/

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs