nginx location

#"~"  must be used for case sensitive matching
#"~*" must be used for case insensitive matching
location  = / {
  # this matches only the / query.

  # configuration example #1
}
location  / {
  # matches any query due to the fact that all queries begin at /, however, regular expressions will 
  # be matched at first place.

  # configuration example #2  
}
location /data/ {
  # this config matches any query beginning with /data/ and then continues searching,
  # in this example regular expressions will be checked and /data/ will be matched only if
  # regular expressions don't find a match.

  # configuration example #3
}
location ^~ /img/ {
  # matches any query beginning with /img/ and then stops searching,
  # in this example there is not place for regular expressions.

  # configuration example #4 
}
location ~* .(png|ico|gif|jpg|jpeg)$ {
  # this config matches any request ending in png, ico, gif, jpg or jpeg. However, all
  # requests to the /img/ directory will be handled by the previous location block we defined
  # at the previous example config #4

  # your configuration here #5  
}