# Alias in Nginx

**URL:** <https://www.ruby-forum.com/t/alias-in-nginx/186104>\
**Category:** NGINX\
**Created:** [March 31, 2010, 5:27pm UTC](https://www.ruby-forum.com/t/alias-in-nginx/186104 "2010-03-31T17:27:04Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Michel\_Vega\_Fuenzal](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/c77e96/32.png) [@Michel\_Vega\_Fuenzal](https://www.ruby-forum.com/u/Michel_Vega_Fuenzal)\
**Post date:** [March 31, 2010, 5:27pm UTC](https://www.ruby-forum.com/t/alias-in-nginx/186104/1 "2010-03-31T17:27:04Z")

</div>

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?

Thank for all.

–  
Usemos el Software Libre “Con todos y para el bien de todos”  
José Martí, 26 de noviembre de 1891, Tampa.

Lic. Michel Vega Fuenzalida. Usuario Linux: 353763  
Coordinador del Grupo Linux Pinero  
Administrador de Red  
Hospital General Docente “Héroes de Baire”,  
Nueva Gerona, Isla de la Juventud, Cuba.

Teléfono: +53 46 323012.

–

Este mensaje le ha llegado mediante el servicio de correo electronico  
que ofrece Infomed para respaldar el cumplimiento de las misiones del  
Sistema Nacional de Salud. La persona que envia este correo asume el  
compromiso de usar el servicio a tales fines y cumplir con las  
regulaciones establecidas

Infomed: [http://www.sld.cu/](http://www.sld.cu/)

---

<div class="post-metadata">

**Author:** ![Michel\_Vega\_Fuenzal](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/c77e96/32.png) [@Michel\_Vega\_Fuenzal](https://www.ruby-forum.com/u/Michel_Vega_Fuenzal)\
**Post date:** [March 31, 2010, 5:54pm UTC](https://www.ruby-forum.com/t/alias-in-nginx/186104/2 "2010-03-31T17:54:02Z")

</div>

Hello!

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:

> **[GitHub - nginxinc/nginx-wiki: ARCHIVED -- Source for the now archived NGINX Wiki...](https://github.com/nginxinc/nginx-wiki)**
>
> ARCHIVED -- Source for the now archived NGINX Wiki section of https://www.nginx.com

> **[GitHub - nginxinc/nginx-wiki: ARCHIVED -- Source for the now archived NGINX Wiki...](https://github.com/nginxinc/nginx-wiki)**
>
> ARCHIVED -- Source for the now archived NGINX Wiki section of https://www.nginx.com

> **[GitHub - nginxinc/nginx-wiki: ARCHIVED -- Source for the now archived NGINX Wiki...](https://github.com/nginxinc/nginx-wiki)**
>
> ARCHIVED -- Source for the now archived NGINX Wiki section of https://www.nginx.com

Maxim D.
