Questions about root and alias directives

Nikolaos Milas nmilas at
Fri Jan 20 10:15:30 UTC 2017


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 "", the above config 
produces a request for the following path:


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:


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:


How should I do it?

Thanks in advance,

More information about the nginx mailing list