Problem when using subfolder

Maxim Dounin mdounin at mdounin.ru
Tue Dec 25 16:07:53 UTC 2012


Hello!

On Tue, Dec 25, 2012 at 11:04:03AM -0500, PascalTurbo wrote:

> Hi There,
> 
> need to solve the following Problem:
> 
> location / should point to /var/www/myfirstside
> and location /subside should point to /var/www/mysecondside
> 
> I have no idea how to solve this.
> 
> I tried:
> 
> location / {
>   root /var/www/myfirstside
> }
> 
> location /subside {
>   root /var/www/mysecondside
> }
> 
> but this doesn't work because nginx send all requests for /subside to
> /var/www/mysecondside/subside ...
> 
> Could anybody help me?

Try "alias":

    location / {
        root /var/www/myfirstside;
    }

    location /subside/ {
        alias /var/www/mysecondside/;
    }

See http://nginx.org/r/alias for details.

-- 
Maxim Dounin
http://nginx.com/support.html



More information about the nginx mailing list