亚洲免费在线视频-亚洲啊v-久久免费精品视频-国产精品va-看片地址-成人在线视频网

您的位置:首頁技術文章
文章詳情頁

web - nginx location 搜索算法問題?。?/h1>
瀏覽:112日期:2023-08-15 15:30:01

問題描述

先貼出我的server配置:

server { listen 80; server_name xxx; # 1 location = /favicon.ico {root /home/www-data/static;rewrite (.*) /img/designs/admin-favicon.ico; } #2 location = /robots.txt {root /home/www-data/static;rewrite (.*) /admin-robots.txt; } # 3 location / {proxy_pass_header Server;proxy_set_header Host $http_host;proxy_redirect off;proxy_set_header X-Real-IP $remote_addr;proxy_set_header X-Scheme $scheme;proxy_pass http://127.0.0.1:22222; }}

官方給出的location搜索路徑優先級和算法描述如下:

To find location matching a given request, nginx first checks locations defined using the prefix strings (prefix locations). Among them, the location with the longest matching prefix is selected and remembered. Then regular expressions are checked, in the order of their appearance in the configuration file. The search of regular expressions terminates on the first match, and the corresponding configuration is used. If no match with a regular expression is found then the configuration of the prefix location remembered earlier is used.

按照我的理解,Nginx搜索的時候算法應該是這樣的:

按照請求前綴搜索location最長普通前綴匹配(如果有=修飾符,則直接匹配該location,如果有^~修飾符,則直接使用該location),記住最長匹配location。 繼續按照配置順序搜索正則匹配,如果有,則直接匹配第一個匹配到的location,否則使用普通最長location

也就說,按照我的配置,瀏覽器請求/favicon.ico的時候,應該是直接精準匹配到 1 才對啊,可是每次都匹配到 3。這里請教一下各位,我對Nginx location的理解有沒有偏差?然后為什么我的配置會是這樣的結果?

問題解答

回答1:

按照樓主的方法配置了一下,我這里是可以進到# 1的。我覺得可能是CDN緩存的問題。樓主試試別的文件rewrite或者在沒有CDN的環境下試試。

標簽: web
相關文章:

主站蜘蛛池模板: 中文字幕亚洲一区二区va在线 | 日本一级特黄a大片在线 | 中文字幕无线精品乱码一区 | 91久久精品一区二区 | 成年人网站免费在线观看 | 黄页网站18以下禁止观看 | 亚洲精品专区一区二区三区 | 亚洲国产成人最新精品资源 | 欧美日韩一区二区高清视 | 国产一区免费在线观看 | 国产男女免费视频 | 久久中文字幕久久久久91 | 国产激情自拍 | 精品免费国产 | 深夜做爰性大片中文 | 荡公乱妇蒂芙尼中文字幕 | 欧美成人小视频 | 亚洲自拍偷拍图 | 国产97公开成人免费视频 | 久久综合免费 | 国产丝袜美女一区二区三区 | 国产精品国产三级国产专区5o | 粉嫩高中生的第一次在线观看 | 99久久国产免费 - 99久久国产免费 | 最新精品国产 | 91久久国产精品视频 | 欧美在线视频不卡 | 怡红院亚洲红怡院天堂麻豆 | 国产精品久久一区一区 | 亚洲成在人线久久综合 | 免费一级做a爰片久久毛片 免费一级做a爰片性色毛片 | 亚洲高清一区二区三区 | 亚洲欧美视频 | 国产欧美久久久另类精品 | 国产成人福利免费观看 | 久久久网站亚洲第一 | 亚洲精品人成在线观看 | 日本一区二区三区不卡在线视频 | 欧美日韩亚洲精品一区 | 一个人免费看的www 一及 片日本 | 99久久精品免费看国产免费软件 |