Welcome! Log In Create A New Profile

Advanced

Questions about root and alias directives

Nikolaos Milas
January 20, 2017 05:16AM
Hello,

I need a config which includes multiple different physical paths.

So I have:

server {

listen [::]:80;
...
root /var/webs/wwwmain/www/;

index index.php index.html index.htm;

...

location / {
try_files $uri $uri/ /index.php?$args;
}

location /museum/ {
root /var/webs/wwwmuseum/;
}

...

}

Now, when I request "http://www.example.com/museum/", the above config
produces a request for the following path:

/var/webs/wwwmuseum/museum/index.php

I think this is the expected result, according to the documentation.

If I change the last part to use an alias directive:

location /museum/ {
alias /var/webs/wwwmuseum/;
}

then the evaluated path becomes:

/var/webs/wwwmain/www/museum/index.html

The alias directive does not seem to have any effect. (Why is that so?)

So, in both cases, I cannot achieve the *desired* path which is:

/var/webs/wwwmuseum/index.html

How should I do it?

Thanks in advance,
Nick

_______________________________________________
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx
Subject Author Posted

Questions about root and alias directives

Nikolaos Milas January 20, 2017 05:16AM

Re: Questions about root and alias directives

Valentin V. Bartenev January 20, 2017 11:32AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 144
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready