How to get a 404 logged with try_files?

monster nginx-forum at
Mon May 2 22:21:48 MSD 2011

Found it! It must look like this, putting =404 as last location in

location ~ ^/img/[^\.]*$ {
        try_files $uri.png $uri.jpg $uri.gif $uri =404;
        error_page  404	/img/missing;

That would be useful information to put in the try_files wiki...

Posted at Nginx Forum:,194965,195019#msg-195019

More information about the nginx mailing list