{"id":1,"date":"2026-03-29T16:48:26","date_gmt":"2026-03-29T08:48:26","guid":{"rendered":"http:\/\/192.168.116.76\/?p=1"},"modified":"2026-03-29T23:06:24","modified_gmt":"2026-03-29T15:06:24","slug":"hello-world","status":"publish","type":"post","link":"https:\/\/note.findrichard.com\/?p=1","title":{"rendered":"Apache\u7684\u61c9\u7528"},"content":{"rendered":"\n<p>\u9019\u662f\u4e00\u500b\u6a19\u6e96\u7684 Apache \u8a2d\u5b9a\u9700\u6c42\u3002\u70ba\u4e86\u9054\u6210\u4f60\u7684\u76ee\u6a19\uff0c\u6211\u5011\u9700\u8981\u5728 <code>&lt;VirtualHost&gt;<\/code> \u5c64\u7d1a\u9650\u5236\u4e3b\u6a5f\u540d\u7a31\uff08ServerName\uff09\uff0c\u4e26\u5728 <code>&lt;Directory&gt;<\/code> \u5c64\u7d1a\u9650\u5236\u5b58\u53d6\u4f86\u6e90\u3002<\/p>\n\n\n\n<p>\u4f60\u53ef\u4ee5\u5c07\u8a2d\u5b9a\u4fee\u6539\u5982\u4e0b\uff1a<\/p>\n\n\n\n<p>Apache<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>&lt;VirtualHost *:80&gt;\n    # 1. \u53ea\u63a5\u53d7\u7279\u5b9a\u7684\u7db2\u57df\u540d\u7a31\n    ServerName note.findrichard.com\n    \n    DocumentRoot \/var\/www\/wordpress\n\n    &lt;Directory \/var\/www\/wordpress&gt;\n        Options FollowSymLinks\n        # \u5efa\u8b70\u5c07 AllowOverride \u8a2d\u70ba All \u4ee5\u78ba\u4fdd WordPress \u7684 .htaccess \u6b63\u5e38\u904b\u4f5c\n        AllowOverride Limit Options FileInfo\n        DirectoryIndex index.php\n\n        # 2. \u5b58\u53d6\u63a7\u5236\uff1a\u53ea\u5141\u8a31\u4f86\u81ea\u672c\u6a5f\u8207\u4ee3\u7406\u4f3a\u670d\u5668\n        &lt;RequireAny&gt;\n            Require ip 192.168.116.73\n            Require local\n        &lt;\/RequireAny&gt;\n    &lt;\/Directory&gt;\n\n    &lt;Directory \/var\/www\/wordpress\/wp-content&gt;\n        Options FollowSymLinks\n        &lt;RequireAny&gt;\n            Require ip 192.168.116.73\n            Require local\n        &lt;\/RequireAny&gt;\n    &lt;\/Directory&gt;\n&lt;\/VirtualHost&gt;\n<\/code><\/pre>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h3 class=\"wp-block-heading\">\u95dc\u9375\u4fee\u6539\u8aaa\u660e\uff1a<\/h3>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong><code>ServerName note.findrichard.com<\/code><\/strong>: \u9019\u78ba\u4fdd\u4e86\u7576\u8acb\u6c42\u9032\u5165\u4f3a\u670d\u5668\u6642\uff0cApache \u53ea\u6703\u5c07\u91dd\u5c0d\u8a72\u7db2\u57df\u7684\u8acb\u6c42\u4ea4\u7d66\u9019\u500b VirtualHost \u8655\u7406\u3002\u5982\u679c\u6709\u4eba\u5617\u8a66\u7528 IP \u76f4\u63a5\u5b58\u53d6\uff0c\u4e14\u9019\u662f\u552f\u4e00\u7684\u8a2d\u5b9a\u6a94\uff0c\u4ed6\u5011\u53ef\u80fd\u6703\u770b\u5230\u932f\u8aa4\u6216\u9810\u8a2d\u9801\u9762\uff08\u53d6\u6c7a\u65bc\u4f60\u7684\u9810\u8a2d\u4e3b\u6a5f\u8a2d\u5b9a\uff09\u3002<\/li>\n\n\n\n<li><strong><code>&lt;RequireAny><\/code> \u5340\u584a<\/strong>:\n<ul class=\"wp-block-list\">\n<li><code>Require ip 192.168.116.73<\/code>: \u660e\u78ba\u5141\u8a31\u4f60\u7684\u4ee3\u7406\u4f3a\u670d\u5668\u3002<\/li>\n\n\n\n<li><code>Require local<\/code>: \u5141\u8a31\u4f3a\u670d\u5668\u81ea\u8eab\u5b58\u53d6\uff08\u9019\u5c0d\u67d0\u4e9b\u5167\u90e8 cron job \u6216\u5065\u5eb7\u6aa2\u67e5\u5f88\u6709\u5e6b\u52a9\uff09\u3002<\/li>\n<\/ul>\n<\/li>\n\n\n\n<li><strong>\u5b89\u5168\u6027\u63d0\u9192<\/strong>: \u5982\u679c\u4f60\u7684 WordPress \u4f4d\u65bc\u4ee3\u7406\u4f3a\u670d\u5668\uff08Proxy\uff09\u5f8c\u65b9\uff0c\u5efa\u8b70\u5b89\u88dd\u4e26\u555f\u7528 <code>mod_remoteip<\/code> \u6a21\u7d44\uff0c\u9019\u6a23 WordPress \u7684\u65e5\u8a8c\u624d\u80fd\u8a18\u9304\u5230\u771f\u5be6\u8a2a\u5ba2\u7684 IP\uff0c\u800c\u4e0d\u662f\u6c38\u9060\u53ea\u986f\u793a <code>192.168.116.73<\/code>\u3002<\/li>\n<\/ul>\n\n\n\n<h3 class=\"wp-block-heading\">\u4fee\u6539\u5f8c\u7684\u6b65\u9a5f\uff1a<\/h3>\n\n\n\n<p>\u57f7\u884c <code>sudo systemctl restart apache2<\/code> (\u6216 <code>httpd<\/code>) \u5957\u7528\u8b8a\u66f4\u3002<\/p>\n\n\n\n<p>\u5132\u5b58\u8a2d\u5b9a\u6a94\u3002<\/p>\n\n\n\n<p>\u57f7\u884c <code>sudo apachectl configtest<\/code> \u6aa2\u67e5\u8a9e\u6cd5\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u9019\u662f\u4e00\u500b\u6a19\u6e96\u7684 Apache \u8a2d\u5b9a\u9700\u6c42\u3002\u70ba\u4e86\u9054\u6210\u4f60\u7684\u76ee\u6a19\uff0c\u6211\u5011\u9700\u8981\u5728 &lt;VirtualHost&gt;  [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[8],"tags":[],"class_list":["post-1","post","type-post","status-publish","format-standard","hentry","category-solutionbote"],"_links":{"self":[{"href":"https:\/\/note.findrichard.com\/index.php?rest_route=\/wp\/v2\/posts\/1","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/note.findrichard.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/note.findrichard.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/note.findrichard.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/note.findrichard.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1"}],"version-history":[{"count":3,"href":"https:\/\/note.findrichard.com\/index.php?rest_route=\/wp\/v2\/posts\/1\/revisions"}],"predecessor-version":[{"id":33,"href":"https:\/\/note.findrichard.com\/index.php?rest_route=\/wp\/v2\/posts\/1\/revisions\/33"}],"wp:attachment":[{"href":"https:\/\/note.findrichard.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/note.findrichard.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/note.findrichard.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}