nginx - some notes after reading
2021-05-07 本文已影响0人
老杜振熙
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.