{"id":3185,"date":"2017-01-25T10:32:52","date_gmt":"2017-01-25T02:32:52","guid":{"rendered":"https:\/\/ixyzero.com\/blog\/?p=3185"},"modified":"2017-01-25T10:45:58","modified_gmt":"2017-01-25T02:45:58","slug":"%e7%94%a8nginx%e5%af%b9wordpress%e8%bf%9b%e8%a1%8c%e7%ae%80%e5%8d%95%e9%98%b2%e6%8a%a4","status":"publish","type":"post","link":"https:\/\/ixyzero.com\/blog\/archives\/3185.html","title":{"rendered":"\u7528Nginx\u5bf9WordPress\u8fdb\u884c\u7b80\u5355\u9632\u62a4"},"content":{"rendered":"<p>=Start=<\/p>\n<h4>\u7f18\u7531\uff1a<\/h4>\n<p>\u5f3a\u8feb\u75c7<\/p>\n<h4>\u6b63\u6587\uff1a<\/h4>\n<h5>\u53c2\u8003\u89e3\u7b54\uff1a<\/h5>\n<p>\u4e00\u822c\u6765\u8bf4\uff0c\u73b0\u5728\u6d41\u884c\u7684CMS\u6846\u67b6\u91cc\u9762\uff0cWordPress\u53ef\u4ee5\u8bf4\u662f\u76f8\u5bf9\u6bd4\u8f83\u5b89\u5168\u7684\u4e00\u4e2a\u4e86\uff0c\u4e3a\u4e86\u4fdd\u8bc1VPS\/blog\u7684\u5b89\u5168\uff0c\u9664\u4e86\u53ca\u65f6\u5347\u7ea7WordPress\u4e4b\u5916\uff0c\u8fd8\u53ef\u4ee5\u5728Nginx\u5c42\u9762\u505a\u4e00\u4e9b\u7b80\u5355\u7684\u9632\u62a4\u64cd\u4f5c\uff0c\u907f\u514d\u56e0\u4e3a\u8fd0\u7ef4\u5931\u8bef\u5bfc\u81f4VPS\/blog\u88ab\u5165\u4fb5\/\u6302\u9a6c\u3002\u4e0b\u9762\u7b80\u5355\u8bf4\u4e00\u4e0b\u6211\u4e86\u89e3\u7684&amp;\u6b63\u5728\u7528\u7684\u4e00\u4e9bNginx\u914d\u7f6e\uff1a<\/p>\n<pre class=\"lang:default decode:true \">user nginx nginx; #\u4ee5\u4f4e\u6743\u9650\u8fd0\u884cNginx\r\n\r\nhttp {\r\n    server_tokens off; #\u4e0d\u663e\u793aNginx\u7684\u5177\u4f53\u7248\u672c\u4fe1\u606f\r\n    charset utf-8;\r\n    ...\r\n    limit_conn_zone $binary_remote_addr zone=perip:10m; #\u9650\u5236\u8fde\u63a5\u901f\u5ea6\r\n    # If enable limit_conn_zone, add \"limit_conn perip 10;\" to server section.\r\n    server {\r\n        ...\r\n        limit_conn perip 10;\r\n        ...\r\n        location ~* \/wp-includes\/.*.php$ { #\u7981\u6b62\u89e3\u91ca\u6267\u884cwp-includes\u76ee\u5f55\u4e2d\u7684PHP\u6587\u4ef6\r\n            deny all;\r\n            # access_log off;\r\n            # log_not_found off;\r\n        }\r\n\r\n        location ~* \/(?:uploads|files)\/.*.php$ { #\u7981\u6b62\u89e3\u91ca\u6267\u884cuploads\/files\u76ee\u5f55\u4e2d\u7684PHP\u6587\u4ef6\uff08\u4f7f\u88ab\u4e0a\u4f20\u7684webshell\u4e0d\u53ef\u6267\u884c\uff09\r\n            deny all;\r\n            # access_log off;\r\n            # log_not_found off;\r\n        }\r\n\r\n        location = \/xmlrpc.php { #\u7981\u7528WordPress\u7684xmlrpc\u529f\u80fd\r\n            deny all;\r\n            # access_log off;\r\n            # log_not_found off;\r\n        }\r\n\r\n        location ~ .*\\.(gif|jpg|jpeg|png|bmp|swf)$ { #\u9632\u76d7\u94fe\r\n            expires 30d;\r\n            valid_referers blocked *.ixyzero.com server_names ~\\.google\\. ~\\.baidu\\.;\r\n            # valid_referers none blocked *.ixyzero.com server_names ~\\.google\\. ~\\.baidu\\.; #\u8fd9\u91cc\u7684none\u6307\u7684\u662frefer\u4e3a\u7a7a\u7684\u60c5\u51b5\uff0c\u8bf7\u6309\u9700\u4f7f\u7528\r\n            if ($invalid_referer) {\r\n                return 403;\r\n                # rewrite ^\/ http:\/\/ixyzero.com\/403.jpg;\r\n            }\r\n        }\r\n\r\n        location ~ .*\\.(js|css)?$ {\r\n            expires      12h;\r\n        }\r\n\r\n        # \u9632\u6b62Web\u76ee\u5f55\u4e2d\u7684\u654f\u611f\u6587\u4ef6\u88ab\u4e0b\u8f7d\r\n        location ~* \\.(rar|zip|gz|tar|tgz|tar.gz|7z|z|bz2|tar.bz2|sql|log|ini|bak|old|conf|idea|DS_Store|swp|svn\/entries|git\/config)$ {\r\n            deny all;\r\n        }\r\n    }\r\n}<\/pre>\n<h5>\u53c2\u8003\u94fe\u63a5\uff1a<\/h5>\n<ul>\n<li><a href=\"http:\/\/www.ttlsa.com\/nginx\/nginx-referer\/\">http:\/\/www.ttlsa.com\/nginx\/nginx-referer\/<\/a><\/li>\n<li><a href=\"http:\/\/www.ttlsa.com\/nginx\/nginx-modules-secure_link\/\">http:\/\/www.ttlsa.com\/nginx\/nginx-modules-secure_link\/<\/a><\/li>\n<li><a href=\"http:\/\/www.ccvita.com\/312.html\">http:\/\/www.ccvita.com\/312.html<\/a><\/li>\n<li><a href=\"https:\/\/wizardforcel.gitbooks.io\/nginx-doc\/content\/Text\/7.5_doorchain.html\">https:\/\/wizardforcel.gitbooks.io\/nginx-doc\/content\/Text\/7.5_doorchain.html<\/a><\/li>\n<li><a href=\"https:\/\/www.teakki.com\/p\/57dbc843b6b159ae0e35df9f\">Nginx\u7981\u6b62IP\u8bbf\u95ee<\/a><\/li>\n<li><a href=\"https:\/\/www.leavesongs.com\/PENETRATION\/nginx-safe-dir.html\">https:\/\/www.leavesongs.com\/PENETRATION\/nginx-safe-dir.html<\/a><\/li>\n<li><a href=\"https:\/\/www.cyberciti.biz\/tips\/linux-unix-bsd-nginx-webserver-security.html\">https:\/\/www.cyberciti.biz\/tips\/linux-unix-bsd-nginx-webserver-security.html<\/a><\/li>\n<li><a href=\"http:\/\/stackoverflow.com\/questions\/32960967\/nginx-location-deny-by-file-extension-syntax\">http:\/\/stackoverflow.com\/questions\/32960967\/nginx-location-deny-by-file-extension-syntax<\/a><\/li>\n<\/ul>\n<p>=END=<\/p>\n","protected":false},"excerpt":{"rendered":"<p>=Start= \u7f18\u7531\uff1a \u5f3a\u8feb\u75c7 \u6b63\u6587\uff1a \u53c2\u8003\u89e3\u7b54\uff1a \u4e00\u822c\u6765\u8bf4\uff0c\u73b0\u5728\u6d41\u884c\u7684CMS\u6846\u67b6\u91cc\u9762\uff0cWordPress\u53ef\u4ee5 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[23,25],"tags":[75,337],"class_list":["post-3185","post","type-post","status-publish","format-standard","hentry","category-knowledgebase-2","category-security","tag-nginx","tag-nginx-conf"],"views":6993,"_links":{"self":[{"href":"https:\/\/ixyzero.com\/blog\/wp-json\/wp\/v2\/posts\/3185","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/ixyzero.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/ixyzero.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/ixyzero.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/ixyzero.com\/blog\/wp-json\/wp\/v2\/comments?post=3185"}],"version-history":[{"count":3,"href":"https:\/\/ixyzero.com\/blog\/wp-json\/wp\/v2\/posts\/3185\/revisions"}],"predecessor-version":[{"id":3195,"href":"https:\/\/ixyzero.com\/blog\/wp-json\/wp\/v2\/posts\/3185\/revisions\/3195"}],"wp:attachment":[{"href":"https:\/\/ixyzero.com\/blog\/wp-json\/wp\/v2\/media?parent=3185"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/ixyzero.com\/blog\/wp-json\/wp\/v2\/categories?post=3185"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/ixyzero.com\/blog\/wp-json\/wp\/v2\/tags?post=3185"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}