Setting header for fastcgi response

Francis Daly francis at daoine.org
Sat Nov 24 10:48:26 UTC 2012


On Sat, Nov 24, 2012 at 01:58:16PM +0800, howard chen wrote:

Hi there,

in nginx, one request is handled in one location.

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

Your request for /foo should be handled in that location. It will,
depending on the configuration that you haven't shown, try to serve the
file /usr/local/nginx/html/foo with a few extra http headers.

> This path does not exist, and it goes into the fcgi using
> 
> location / {
>   try_files $uri $uri/ /index.php?$args;
> }

The configuration you have shown does not indicate that that will happen.

(Unless, perhaps, you have something like an error_page directive
in place.)

>  curl -v  'http://www.example.com/foo'
> 
> < HTTP/1.1 404 Not Found
> bar <-- actual output from backend, but why 404?
> 
> Any idea?

Can you provide a config file that is enough to demonstrate what you
are reporting?

Thanks,

	f
-- 
Francis Daly        francis at daoine.org



More information about the nginx mailing list