nginx rewrite
nginx配置 if {} () 等前后必须有空格 隔开
location模块
This location block specifies the “/” prefix compared with the URI from the request. For matching requests, the URI will be added to the path specified in the root directive, that is, to /data/www, to form the path to the requested file on the local file system. If there are several matchinglocation blocks nginx selects the one with the longest prefix. The location block above provides the shortest prefix, of length one, and so only if all other location blocks fail to provide a match, this block will be used.
先匹配前缀规则 记住最长的匹配规则 然后匹配正则规则 如果有匹配的正则规则 就 使用正则规则 如果没有 就使用最长前缀的规则
location 模块的规则是 location [=|~|~*|^~|@] 没有取反操作 取反操作请在正则中配置 例如
nginx location上正则取反是用“?!”,而不是“!~”,位置和写法这样写:
浙公网安备 33010602011771号