nginx.pid的作用:記錄nginx的main process的pid,方便kill
的調用;(因為調用kill
需要提供pid)
請求uri:請求uri是不包含query string的uri,比如http://localhost:8080/test/a=1
的請求uri指的是/test
;nginx通過請求uri和location進行匹配
location的正則:其實正則就是perl規范的,只是location的正則需要以~
或~*
開頭
location匹配規則:所有可以匹配的location中,先選有正則的location,其次再選最長的location;[ = | ~ | ~* | ^~ | @]
是可以包含的前綴,各自的意義見nginx配置location - 簡書 (jianshu.com)
When nginx selects a
location
block to serve a request it first checks location directives that specify prefixes, rememberinglocation
with the longest prefix, and then checks regular expressions. If there is a match with a regular expression, nginx picks thislocation
or, otherwise, it picks the one remembered earlier.