💎一站式轻松地调用各大LLM模型接口,支持GPT4、智谱、星火、月之暗面及文生图 广告
## 多个server_name中虚拟主机读取的优先级 ``` server { listen 80; server_name testserver1 jesont . tinywan . io; location{ root path / server1; } } server { listen 80; server_name testserver2 jesont . tinywan . io; location{ root path/server2; } } ``` > 优先级:优先读取最先读取的配置,server1、server2、server3 ## 多个location匹配的优先级 **匹配规则** `= `:进行普通字符精确匹配,也就是完全匹配 `^~`:表示普通字符匹配,使用前缀匹配 `~\~*`:表示执行一个正则匹配 **案例** ``` location = /code1/ { rewrite ^(.*)$ /code1/index.html break; } location ~ /code.* { rewrite ^(.*)$ /code3/index.html break; } location ^~ /code { rewrite ^(.*)$ /code2/index.html break; } ``` 访问:`127.0.0.1/code1` 优先级:组匹配:`code1`。`code1`注释掉,最匹配:`code3`。`code3`注释掉,最后匹配:`code2`