{"id":4339,"date":"2021-01-18T15:10:49","date_gmt":"2021-01-18T07:10:49","guid":{"rendered":"https:\/\/www.baishitou.cn\/?p=4339"},"modified":"2021-01-18T15:14:42","modified_gmt":"2021-01-18T07:14:42","slug":"wordpress%e7%a6%81%e6%ad%a2%e6%90%9c%e7%b4%a2%e5%bc%95%e6%93%8e%e6%8a%93%e5%8f%96%e6%8c%87%e5%ae%9a%e8%b7%af%e5%be%84%e6%88%96%e8%80%85%e6%98%af%e5%8a%a8%e6%80%81%e8%b7%af%e5%be%84%e9%a1%b5%e9%9d%a2","status":"publish","type":"post","link":"https:\/\/www.baishitou.cn\/4339.html","title":{"rendered":"wordpress\u7981\u6b62\u641c\u7d22\u5f15\u64ce\u6293\u53d6\u6307\u5b9a\u8def\u5f84\u6216\u8005\u662f\u52a8\u6001\u8def\u5f84\u9875\u9762"},"content":{"rendered":"
\u4eca\u5929\u67e5\u8be2\u53d1\u73b0\u4e0a\u5348\u53d1\u5e03\u7684\u4e00\u7bc7\u6587\u7ae0\u88ab\u6536\u5f55\u4e86\uff0c\u4f46\u6536\u5f55\u7684\u5730\u5740\u5374\u662f\u52a8\u6001\u7684\u3002<\/p>\n
\u53ef\u4ee5\u6211\u7684\u7f51\u7ad9\u662f\u4f2a\u9759\u6001\u7684\uff0c\u6240\u4ee5\u5c31\u4e0d\u60f3\u8ba9\u5b83\u6536\u5f55\u52a8\u6001\u9875\u9762\u3002robots\u91cc\u9762\u52a0\u5165\u4e86\u7981\u6b62\u6293\u53d6\u8fd9\u4e9b\u52a8\u6001\u5730\u5740\u548c\u67d0\u4e9b\u8def\u5f84\uff0c\u4f46\u662f\u8718\u86db\u4f9d\u7136\u6bcf\u5929\u6293\u53d6\uff0c\u800c\u4e14\u8fd8\u6536\u5f55\u4e86\uff01\u6240\u4ee5\u53ea\u80fd\u5f3a\u5236\u7981\u6b62\u5b83\u8bbf\u95ee\u3002<\/p>\n \u628a\u4e0b\u5217\u4ee3\u7801\u52a0\u5165\u5230\u670d\u52a1\u5668\u914d\u7f6e\u6587\u4ef6ROOT\u540e\u9762\u5373\u53ef<\/p>\n<\/a><\/p>\n
#### \u7981\u6b62\u641c\u7d22\u5f15\u64ce\u8bbf\u95ee\u6307\u5b9a\u6587\u4ef6\u5939\u6216\u8005\u8def\u5f84 \u3010\u5f00\u59cb\u3011####\r\n #\u521d\u59cb\u5316\u53d8\u91cf\u4e3a\u7a7a\r\n set $deny_spider \"\";\r\n #\u5982\u679c\u8bf7\u6c42\u5730\u5740\u4e2d\u542b\u6709\u9700\u8981\u7981\u6b62\u6293\u53d6\u5173\u952e\u8bcd\u65f6\uff0c\u5c06\u53d8\u91cf\u8bbe\u7f6e\u4e3ay\uff1a\r\n if ($request_uri ~* \"\\?replytocom=(\\d+)|\\?p=(\\d+)|\/feed|\/date|\/wp-admin|comment-page-(\\d+)|\/go\") {\r\n set $deny_spider 'y';\r\n }\r\n #\u5982\u679c\u6293\u53d6\u7684UA\u4e2d\u542b\u6709spider\u6216bot\u65f6\uff0c\u7ee7\u7eed\u4e3a\u53d8\u91cf\u8d4b\u503c\uff08\u901a\u8fc7\u7d2f\u52a0\u8d4b\u503c\u95f4\u63a5\u5b9e\u73b0nginx\u7684\u591a\u91cd\u6761\u4ef6\u5224\u65ad\uff09\r\n if ($http_user_agent ~* \"spider|bot\") {\r\n set $deny_spider \"${deny_spider}es\";\r\n }\r\n #\u5f53\u6ee1\u8db3\u4ee5\u4e0a2\u4e2a\u6761\u4ef6\u65f6\uff0c\u5219\u8fd4\u56de404\uff0c\u7b26\u5408\u641c\u7d22\u5f15\u64ce\u6b7b\u94fe\u6807\u51c6\r\n if ($deny_spider = 'yes') {\r\n return 403; #\u5982\u679c\u662f\u5220\u9664\u5df2\u6536\u5f55\u7684\uff0c\u5219\u53ef\u4ee5\u8fd4\u56de404\r\n break;\r\n }\r\n #### \u7981\u6b62\u641c\u7d22\u5f15\u64ce\u8bbf\u95ee\u6307\u5b9a\u6587\u4ef6\u5939\u6216\u8005\u8def\u5f84\u3010\u7ed3\u675f\u3011 ####<\/code><\/pre>\n