My configuration looks like this...
server {
listen 80;
server_name 127.0.0.1 localhost;
location = /index.html {
root /etc/nginx/html/app1;
index index.html;
}
location / {
root /etc/nginx/html/app1;
index index.html;
}
location ^~ /common/ {
root /etc/nginx/html/common;
}
}
As you can see, I am trying to have different roots for different locations. Common folder is where I want to keep some common files. Unfortunately, with this configuration, I keep getting 404 for common. Index folder works as expected. If I copy the common folder inside app, it works as expected.
I wouldn't like to keep the common folder inside of app1 though. I am struggling big time with this configuration. Please help.
server {
listen 80;
server_name 127.0.0.1 localhost;
location = /index.html {
root /etc/nginx/html/app1;
index index.html;
}
location / {
root /etc/nginx/html/app1;
index index.html;
}
location ^~ /common/ {
root /etc/nginx/html/common;
}
}
As you can see, I am trying to have different roots for different locations. Common folder is where I want to keep some common files. Unfortunately, with this configuration, I keep getting 404 for common. Index folder works as expected. If I copy the common folder inside app, it works as expected.
I wouldn't like to keep the common folder inside of app1 though. I am struggling big time with this configuration. Please help.