Dummy question

Just read this:

…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:

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