Just read this:
http://wiki.nginx.org/Pitfalls#Root_inside_Location_Block
…which recommands to put root outside location block…
However, the default.conf installed from nginx rpm contains exactly
what should not de done, right ?
location / {
root /usr/share/nginx/html;
index index.html index.htm;
}
location = /50x.html {
root /usr/share/nginx/html;
}
#location ~ \.php$ {
# root html;
# fastcgi_pass 127.0.0.1:9000;
# fastcgi_index index.php;
# fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name;
# include fastcgi_params;
#}
–
Laurent CREPET
In some cases you have no choice then use root inside location (like
different roots for different requests in 1 block or a dynamic root for
a
dynamic request) so when you know what your doing its not a bad thing.
Posted at Nginx Forum:
http://forum.nginx.org/read.php?2,245260,245261#msg-245261
Le 2013-12-05 19:52, itpp2012 a écrit :
In some cases you have no choice then use root inside location (like
different roots for different requests in 1 block or a dynamic root
for a
dynamic request) so when you know what your doing its not a bad
thing.
Yes, I understand, but to remove confusion, the default file could
have:
- a global root outside location block
- some specific root in location blocks, with description (eg: using a
specific root)
–
Laurent CREPET