av一区二区在线观看_亚洲男人的天堂网站_日韩亚洲视频_在线成人免费_欧美日韩精品免费观看视频_久草视

您的位置:首頁技術(shù)文章
文章詳情頁

web - nginx location 搜索算法問題!?

瀏覽:114日期: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搜索路徑優(yōu)先級和算法描述如下:

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搜索的時候算法應(yīng)該是這樣的:

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

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

問題解答

回答1:

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

標簽: web
相關(guān)文章:
主站蜘蛛池模板: 福利片在线 | 国产伦精品一区二区三区免.费 | 精品国产乱码久久久久久蜜柚 | 一级看片免费视频 | 日韩精品国产精品 | 成人在线观看视频网站 | 国产91在线看 | 国产精品海角社区 | 在线性视频| 欧美国产精品一区二区 | 国产普通话对白 | 亚洲做受高潮无遮挡 | 秋霞午夜鲁丝一区二区老狼 | 久久青青 | 女人高潮特级毛片 | 在线观看欧美日韩视频 | 免费看黄色一级片 | 亚洲黄色大片 | 黄色av大片 | 欧美性猛交99久久久久99按摩 | 亚洲一区高清 | 国产三级在线播放 | 美女网站视频在线观看 | 午夜亚洲精品 | 精品国产成人 | 国产免费无遮挡 | 国产成人一区二区三区 | 日韩精品一区二区三区免费视频 | 最新91视频 | 日本a v在线播放 | 精品国产欧美一区二区三区成人 | 999在线视频 | 18色av| 亚色视频 | 亚洲小视频在线观看 | 高潮毛片无遮挡免费看 | 亚洲欧美第一页 | 日韩欧美小视频 | 四虎久久久 | 亚洲黄色在线 | 一级理论片 |