Location and access_log off;

Hello,

I tried to turn off static file logging using this:

    location ~* .(css|js|gif|jpg|jpeg|ico)$ {
        access_log off;
    }

It turned the logging off, that part worked. But it also didn’t serve
any of these files anymore. Same effect was when I tried to redirect
static file log to another file - again no images on web page.

I tried this with 0.7.61 and 0.8.9 versions.

What could be wrong?

Thanks!

Posted at Nginx Forum:

On Thu, Aug 20, 2009 at 11:20:48AM -0400, vilts wrote:

I tried this with 0.7.61 and 0.8.9 versions.

What could be wrong?

What is in error_log ?

Excellent, both versions work. Thanks.

My problem was, that I had the root directive inside ‘location / {}’, so
the other location didn’t pick that up.

Posted at Nginx Forum:

On Thu, Aug 20, 2009 at 12:18:55PM -0400, vilts wrote:

Hi,

Looks like it is trying to search that file from .

2009/08/20 16:14:49 19796#0: *1 open() “/usr/local/nginx-passenger/html/favicon.ico” failed (2: No such file or directory)
2009/08/20 16:14:49 19796#0: *2 open() “/usr/local/nginx-passenger/html/images/nav1_bg1.gif” failed (2: No such file or directory)
2009/08/20 16:14:49 19796#0: *3 open() “/usr/local/nginx-passenger/html/gallery/model3_with_sheath_thumb.jpg” failed (2: No such file or directory)

You should add “root” inside

    location ~* .(css|js|gif|jpg|jpeg|ico)$ {
        access_log off;
        root  /path/to/files;
    }

Hi,

Looks like it is trying to search that file from .

2009/08/20 16:14:49 19796#0: *1 open()
“/usr/local/nginx-passenger/html/favicon.ico” failed (2: No such file or
directory)
2009/08/20 16:14:49 19796#0: *2 open()
“/usr/local/nginx-passenger/html/images/nav1_bg1.gif” failed (2: No such
file or directory)
2009/08/20 16:14:49 19796#0: *3 open()
“/usr/local/nginx-passenger/html/gallery/model3_with_sheath_thumb.jpg”
failed (2: No such file or directory)

What is in error_log ?


Igor S.
Igor Sysoev

Posted at Nginx Forum:

2009/8/21 Igor S. [email protected]:

You should add “root” inside

    location ~* .(css|js|gif|jpg|jpeg|ico)$ {
      access_log off;
      root  /path/to/files;
    }

What is in error_log ?

or put the root outside

root /path/to/root;

location ~* … {

}