correct usage of location context?

Igor Sysoev is at rambler-co.ru
Fri Jun 12 23:18:27 MSD 2009


On Fri, Jun 12, 2009 at 06:05:34PM +0200, Szymon Polom wrote:

> I'm trying to shift my nginx instance from a multi-subdomain-setting to 
> a one-domain-setting. I have the following config in the same server 
> context:
> 
> location /redmine/ {
>  root /var/www/redmine/public;
>  passenger_enabled on;
> }
> 
> location /test/ {
>  root /var/www/test;
>  autoindex on;
> }
> 
> location / {
>  root /var/www/main;
>  autoindex on;
> }
> 
> When I try to access http://example.com/test/testfile, nginx tries to 
> read the file at /var/www/test/test/testfile instead of at 
> /var/www/test/testfile. I guess my configuration is not correct;

As it was already said by Cliff:

location /test/ {
    root /var/www;
    autoindex on;
}

> how can I force nginx to e.g.
> 
> serve everything beginning with /redmine/
> from /var/www/redmine/public
> 
> ?

location /redmine/ {
    alias /var/www/redmine/public/;
}


-- 
Igor Sysoev
http://sysoev.ru/en/





More information about the nginx mailing list