Alias in Nginx

Maxim Dounin mdounin at
Wed Mar 31 19:53:15 MSD 2010


On Wed, Mar 31, 2010 at 11:25:58AM -0400, Michel Vega Fuenzalida wrote:

> Hello List, sorry my english,
> I would like do like in Apache is make: "Alias /pepe /usr/share/pepe"
> Who I can do it in Nginx?

Use this:

    location /pepe {
        root /usr/share;

In case uri prefix doesn't match directory name, e.g. "Alias /pepe 
/usr/share/something-else", one should use this:

    location /pepe {
        alias /usr/share/something-else;

It is possible to use "alias" in your case too, but variant with 
"root" is a bit more efficient.

See here for details:

Maxim Dounin

More information about the nginx mailing list