Welcome! Log In Create A New Profile

Advanced

location...nested location...which one is better?

May 04, 2016 12:18AM
Hi all,

I'm running a website which is based on php.
And I'm trying to use naxsi for my website. But it seems to enable naxsi, we need to put below line within a location:

include /etc/nginx/naxsi.rules;


And an interesting thing I found about location, is that people are using different location sections as following:

example 1

server {
root...
location / {
# ...
location ~ \.php$ {
#...
}
location ~*^.+\.(jpg|jpeg|gif|png|bmp|ico|mp3)$ {
#...
}
}
}

example 2
server {
root...
location / {
# ...
}
location ~ \.php$ {
#...
}
location ~*^.+\.(jpg|jpeg|gif|png|bmp|ico|mp3)$ {
#...
}
}

example 3
server {
root...
# ...
location ~ \.php$ {
#...
}
location ~*^.+\.(jpg|jpeg|gif|png|bmp|ico|mp3)$ {
#...
}
}


For my server, I'm using example 3.

So, is there any performance difference between these 3 different configuration? And which one is better?

And for naxsi, it's easy to include the configuration file in example 1. But for example 2 and 3, how to include the files?

Thanks
Subject Author Posted

location...nested location...which one is better?

meteor8488 May 04, 2016 12:18AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 144
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready