location vs. rewite

Anton Yuzhaninov citrin at citrin.ru
Mon Apr 1 12:56:35 UTC 2013

On 04/01/13 16:51, etrader wrote:
> I want to server favicon from a different place rather than the root folder.
> As I explored I have two options
> 1.
> location = /favicon.ico { alias /var/www/media/images/favicon.X.ico; }

It is working option.

> 2.
> rewrite ^/favicon.ico /var/www/media/images/favicon.X.ico last;

This is wrong - you can rewrite to other location, not to path on file system.
Anyway rewrite does not need here, use location.

More information about the nginx mailing list