{"id":80181,"date":"2020-05-09T17:26:02","date_gmt":"2020-05-09T09:26:02","guid":{"rendered":"http:\/\/4563.org\/?p=80181"},"modified":"2020-05-09T17:26:02","modified_gmt":"2020-05-09T09:26:02","slug":"nginx%e7%a6%81%e6%ad%a2%e6%9f%90%e4%ba%9buser-agent%e6%8a%93%e5%8f%96%e7%bd%91%e7%ab%99","status":"publish","type":"post","link":"http:\/\/4563.org\/?p=80181","title":{"rendered":"nginx\u7981\u6b62\u67d0\u4e9bUser Agent\u6293\u53d6\u7f51\u7ad9"},"content":{"rendered":"\n<p>  \t\t\t\t\t<strong>gnocuil<\/strong>  \t\t\t\t\u5927\u4f6c\u6709\u8bdd\u8bf4 : \t<\/p>\n<h3>nginx\u7981\u6b62\u67d0\u4e9bUser Agent\u6293\u53d6\u7f51\u7ad9<\/h3>\n<p>  \t\t\u53c2\u8003\u7684\u8fd9\u7bc7\u6587\u7ae0https:\/\/zhang.ge\/4458.htm<\/p>\n<p>  \u5b9d\u5854nginx 1.4\u62a5\u9519\uff0c\u6c42\u6307\u5bfc<\/p>\n<p>  nginx:  &quot;if&quot; directive is not allowed here in \/www\/server\/nginx\/conf\/agent_deny.conf:2<br \/>  nginx: configuration file \/www\/server\/nginx\/conf\/nginx.conf test failed<\/p>\n<p>  agent_deny.conf:\u5185\u5bb9\u5982\u4e0b<\/p>\n<p>  #\u7981\u6b62Scrapy\u7b49\u5de5\u5177\u7684\u6293\u53d6<br \/>  if ($http_user_agent ~* (Scrapy|Curl|HttpClient)) {<br \/>  &nbsp; &nbsp;return 403;<br \/>  }<br \/>  #\u7981\u6b62\u6307\u5b9aUA\u53caUA\u4e3a\u7a7a\u7684\u8bbf\u95ee<br \/>  if ($http_user_agent ~* &quot;FeedDemon|Indy Library|Alexa Toolbar|AskTbFXTV|AhrefsBot|CrawlDaddy|CoolpadWebkit|Java|Feedly|UniversalFeedParser|ApacheBench|Microsoft URL Control|Swiftbot|ZmEu|oBot|jaunty|Python-urllib|lightDeckReports Bot|YYSpider|DigExt|HttpClient|MJ12bot|heritrix|EasouSpider|Ezooms|^$&quot; ) {<br \/>  &nbsp; &nbsp;return 403;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp; <br \/>  }<br \/>  #\u7981\u6b62\u975eGET|HEAD|POST\u65b9\u5f0f\u7684\u6293\u53d6<br \/>  if ($request_method !~ ^(GET|HEAD|POST)$) {<br \/>  &nbsp; &nbsp; return 403;<br \/>  }\t\t\t\t<\/p>\n<p>  \t\t\t\t\t<strong>hanada<\/strong>  \t\t\t\t\u5927\u4f6c\u6709\u8bdd\u8bf4 : \t<\/p>\n<h3><\/h3>\n<p>  \t\t\u4f60\u8bd5\u8bd5\u653e\u5728location \/ \u91cc\u5934:lol<\/p>\n<p>  https:\/\/cdn.jsdelivr.net\/gh\/hishis\/forum-master\/public\/images\/patch.gif\t\t\t\t<\/p>\n<p>  \t\t\t\t\t<strong>gnocuil<\/strong>  \t\t\t\t\u5927\u4f6c\u6709\u8bdd\u8bf4 : \t<\/p>\n<h3><\/h3>\n<p>  \t\thanada \u5927\u4f6c\u6709\u8bdd\u8bf4 : 2020-5-9 17:25<br \/>  \u4f60\u8bd5\u8bd5\u653e\u5728location \/ \u91cc\u5934<\/p>\n<p> \u4e00\u6837\u4e5f\u62a5\u9519\u3002\t\t\t\t<\/p>\n<p>  \t\t\t\t\t<strong>iks<\/strong>  \t\t\t\t\u5927\u4f6c\u6709\u8bdd\u8bf4 : \t<\/p>\n<h3><\/h3>\n<p>  \t\t\u4e2d\u95f4\u6709\u7a7a\u683c\uff0c\u5f97\u7528 \/s \u4ee3\u66ff\t\t\t\t<\/p>\n<p>  \t\t\t\t\t<strong>tir<\/strong>  \t\t\t\t\u5927\u4f6c\u6709\u8bdd\u8bf4 : \t<\/p>\n<h3><\/h3>\n<p>  \t\t\u591a\u8c22\u5206\u4eab\uff0c\u4e0d\u8fc7\u767e\u5ea6\u6709\t\t\t\t<\/p>\n<p>  \t\t\t\t\t<strong>GoogleCloud<\/strong>  \t\t\t\t\u5927\u4f6c\u6709\u8bdd\u8bf4 : \t<\/p>\n<h3><\/h3>\n<p>  \t\t\u5b9d\u5854\u90a3\u4e2anginx\u9632\u706b\u5899\u4e0d\u9519\u3002\u3002\t\t\t  <\/p>\n","protected":false},"excerpt":{"rendered":"<p>gnocuil \u5927\u4f6c\u6709\u8bdd\u8bf4 : n&hellip;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[],"tags":[],"_links":{"self":[{"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/posts\/80181"}],"collection":[{"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=80181"}],"version-history":[{"count":0,"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/posts\/80181\/revisions"}],"wp:attachment":[{"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=80181"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=80181"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=80181"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}