Setting header for fastcgi response

howard chen howachen at
Sat Nov 24 05:58:16 UTC 2012


In my nginx config, I have a virtual path (/foo), e.g.

location = /foo {
  expires 1h;
  add_header Cache-Control "public";

This path does not exist, and it goes into the fcgi using

location / {
  try_files $uri $uri/ /index.php?$args;

location ~* \.php$ {

The problem is the 1st location block is adding 404 to every response even
I can route the request to the backend.


 curl -v  ''

< HTTP/1.1 404 Not Found
bar <-- actual output from backend, but why 404?

Any idea?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the nginx mailing list