Nginx root vs alias - hpaluch/hpaluch.github.io GitHub Wiki
When porting Apache Alias
to Nginx it is very easy to do such mistake:
# Apache: Alias /ks /opt/images
# Nginx: WRONG WAY:
location /ks/ {
root /opt/images/;
}
This is wrong! The URL http://localhost/ks/
is mapped to /opt/images/ks
by Nginx (but in Apache
it maps just to /opt/images
)
The right way is to use Nginx's alias
option:
location /ks/ {
alias /opt/images/;
}
Now it should work as expected by Apache webmasters...