Welcome! Log In Create A New Profile

Advanced

Example Proxy Everything of Pitfalls

Posted by Getty 
Example Proxy Everything of Pitfalls
February 20, 2011 12:02AM
Hiho,

After some experiment and after a hint from IRC I used an (GOOD ;) ) example of the Pitfalls page to make some kind of FastCGI Proxy which can be overriden by static files. So I did this:

server {

server_name site.local;

access_log /var/log/nginx/site-access.log;

root /home/torsten/static/site/;

location / {
try_files $uri $uri/ @fastcgi;
}

location @fastcgi {
include fastcgi_params_php;
fastcgi_param STAGE dev;
fastcgi_param SCRIPT_FILENAME /home/torsten/dev/site/web/index.php;
fastcgi_pass 127.0.0.1:9000;
}

}

Which works totally awesome for everything, beside "/". On "/" I always get a Forbidden. But serving of the static files works and serving of the rest through the php works fine.

What I then tried was todo this for the try_files:

try_files $uri $uri @fastcgi;

and hey! suddenly it works fine. Everything static is served, the rest goes through the PHP, all exactly like I wanted it.

When I said that on IRC I had very aggressive negative feedback and was later muted but I still would like to findout why this works now, and what is wrong on the other way?

Actually that would for me say that this Pitfalls example could bring more people into this case.

Oh btw, i use Nginx 0.7.67 from Debian Squeeze, I guessed it might be a version "problem".

Thanks for any information and hint in advance.
Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 148
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 500 on July 15, 2024
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready