Nginx include in location working for whole config

34 Views Asked by At

Nginx config in project I'm working on is split in different files

a.conf 

location a 
{

}

b.conf

location b 
{
  include c.conf
}

c.conf 

location ~ \.php$ {return 404}

when I run nginx -T I get this

#configuration file a.conf        
location a {}

#configuration file b.conf       
location b 
{
  include c.conf
}

#configuration file c.conf            
location ~ \.php$ {return 404}

Does last line mean, that location ~ \.php$ {return 404} will work for every location on server? And I will get 404 response on {host}/a.php, {host}/b.php etc.? Or it will work only for {host}/b.php?

Can I use nginx -T command in that case for reviewing in what order nginx will check locations?

0

There are 0 best solutions below