{"id":41988,"date":"2024-10-02T17:17:05","date_gmt":"2024-10-02T09:17:05","guid":{"rendered":"https:\/\/server.hk\/cnblog\/41988\/"},"modified":"2024-10-02T17:17:05","modified_gmt":"2024-10-02T09:17:05","slug":"apache%e6%95%99%e7%a8%8b%ef%bc%9aapache-%e6%97%a5%e8%aa%8c%e6%a0%bc%e5%bc%8f","status":"publish","type":"post","link":"https:\/\/server.hk\/cnblog\/41988\/","title":{"rendered":"Apache\u6559\u7a0b\uff1aApache \u65e5\u8a8c\u683c\u5f0f"},"content":{"rendered":"<h1 id=\"apache%e6%95%99%e7%a8%8b%ef%bc%9aapache-%e6%97%a5%e8%aa%8c%e6%a0%bc%e5%bc%8f-gUmlXFEGvq\">Apache\u6559\u7a0b\uff1aApache \u65e5\u8a8c\u683c\u5f0f<\/h1>\n<p>Apache HTTP \u4f3a\u670d\u5668\u662f\u5168\u7403\u6700\u53d7\u6b61\u8fce\u7684\u7db2\u9801\u4f3a\u670d\u5668\u4e4b\u4e00\uff0c\u5ee3\u6cdb\u61c9\u7528\u65bc\u5404\u7a2e\u7db2\u7ad9\u548c\u61c9\u7528\u7a0b\u5f0f\u4e2d\u3002\u4e86\u89e3 Apache \u7684\u65e5\u8a8c\u683c\u5f0f\u5c0d\u65bc\u7cfb\u7d71\u7ba1\u7406\u54e1\u548c\u958b\u767c\u8005\u4f86\u8aaa\u81f3\u95dc\u91cd\u8981\uff0c\u56e0\u70ba\u9019\u4e9b\u65e5\u8a8c\u63d0\u4f9b\u4e86\u6709\u95dc\u4f3a\u670d\u5668\u904b\u884c\u72c0\u6cc1\u548c\u7528\u6236\u884c\u70ba\u7684\u5bf6\u8cb4\u8cc7\u8a0a\u3002<\/p>\n<h2 id=\"apache-%e6%97%a5%e8%aa%8c%e7%9a%84%e9%a1%9e%e5%9e%8b-gUmlXFEGvq\">Apache \u65e5\u8a8c\u7684\u985e\u578b<\/h2>\n<p>Apache \u4e3b\u8981\u6709\u5169\u7a2e\u65e5\u8a8c\uff1a\u8a2a\u554f\u65e5\u8a8c\uff08access log\uff09\u548c\u932f\u8aa4\u65e5\u8a8c\uff08error log\uff09\u3002<\/p>\n<ul>\n<li><strong>\u8a2a\u554f\u65e5\u8a8c\uff1a<\/strong>\u8a18\u9304\u6240\u6709\u9032\u5165\u4f3a\u670d\u5668\u7684\u8acb\u6c42\uff0c\u5305\u62ec\u7528\u6236\u7684 IP \u5730\u5740\u3001\u8acb\u6c42\u7684 URL\u3001HTTP \u72c0\u614b\u78bc\u7b49\u3002<\/li>\n<li><strong>\u932f\u8aa4\u65e5\u8a8c\uff1a<\/strong>\u8a18\u9304\u4f3a\u670d\u5668\u5728\u8655\u7406\u8acb\u6c42\u6642\u767c\u751f\u7684\u932f\u8aa4\uff0c\u9019\u5c0d\u65bc\u6545\u969c\u6392\u9664\u548c\u6027\u80fd\u512a\u5316\u975e\u5e38\u91cd\u8981\u3002<\/li>\n<\/ul>\n<h2 id=\"apache-%e8%a8%aa%e5%95%8f%e6%97%a5%e8%aa%8c%e6%a0%bc%e5%bc%8f-gUmlXFEGvq\">Apache \u8a2a\u554f\u65e5\u8a8c\u683c\u5f0f<\/h2>\n<p>Apache \u8a2a\u554f\u65e5\u8a8c\u7684\u683c\u5f0f\u53ef\u4ee5\u6839\u64da\u9700\u8981\u9032\u884c\u81ea\u5b9a\u7fa9\uff0c\u4f46\u9ed8\u8a8d\u683c\u5f0f\u901a\u5e38\u662f\u300cCommon Log Format\u300d\uff08CLF\uff09\u6216\u300cCombined Log Format\u300d\u3002\u4ee5\u4e0b\u662f\u9019\u5169\u7a2e\u683c\u5f0f\u7684\u8a73\u7d30\u8aaa\u660e\uff1a<\/p>\n<h3 id=\"common-log-format-clf-gUmlXFEGvq\">Common Log Format (CLF)<\/h3>\n<pre>\n<code>\n127.0.0.1 - - [10\/Oct\/2000:13:55:36 -0700] \"GET \/apache_pb.gif HTTP\/1.0\" 200 2326\n<\/code>\n<\/pre>\n<p>\u5728\u9019\u500b\u683c\u5f0f\u4e2d\uff0c\u5404\u500b\u5b57\u6bb5\u7684\u542b\u7fa9\u5982\u4e0b\uff1a<\/p>\n<ul>\n<li><strong>IP \u5730\u5740\uff1a<\/strong>\u7528\u6236\u7684 IP \u5730\u5740\u3002<\/li>\n<li><strong>\u8b58\u5225\u7b26\u865f\uff1a<\/strong>\u901a\u5e38\u70ba\u300c-\u300d\uff0c\u8868\u793a\u672a\u8b58\u5225\u7684\u7528\u6236\u3002<\/li>\n<li><strong>\u7528\u6236\u540d\uff1a<\/strong>\u5982\u679c\u6709\u9032\u884c\u8eab\u4efd\u9a57\u8b49\uff0c\u5247\u986f\u793a\u7528\u6236\u540d\uff0c\u5426\u5247\u70ba\u300c-\u300d\u3002<\/li>\n<li><strong>\u65e5\u671f\u548c\u6642\u9593\uff1a<\/strong>\u8acb\u6c42\u7684\u65e5\u671f\u548c\u6642\u9593\u3002<\/li>\n<li><strong>\u8acb\u6c42\u884c\uff1a<\/strong>\u5305\u542b\u8acb\u6c42\u65b9\u6cd5\u3001\u8acb\u6c42\u7684 URL \u548c HTTP \u5354\u8b70\u7248\u672c\u3002<\/li>\n<li><strong>\u72c0\u614b\u78bc\uff1a<\/strong>\u4f3a\u670d\u5668\u8fd4\u56de\u7684 HTTP \u72c0\u614b\u78bc\u3002<\/li>\n<li><strong>\u5b57\u7bc0\u6578\uff1a<\/strong>\u4f3a\u670d\u5668\u8fd4\u56de\u7684\u5b57\u7bc0\u6578\u3002<\/li>\n<\/ul>\n<h3 id=\"combined-log-format-gUmlXFEGvq\">Combined Log Format<\/h3>\n<pre>\n<code>\n127.0.0.1 - - [10\/Oct\/2000:13:55:36 -0700] \"GET \/apache_pb.gif HTTP\/1.0\" 200 2326 \"http:\/\/www.example.com\/start.html\" \"Mozilla\/5.0\"\n<\/code>\n<\/pre>\n<p>\u9019\u500b\u683c\u5f0f\u5728 CLF \u7684\u57fa\u790e\u4e0a\u589e\u52a0\u4e86\u5169\u500b\u5b57\u6bb5\uff1a<\/p>\n<ul>\n<li><strong>\u5f15\u7528\u9801\u9762\uff1a<\/strong>\u7528\u6236\u5f9e\u54ea\u500b\u9801\u9762\u9ede\u64ca\u9032\u5165\u7576\u524d\u8acb\u6c42\u7684 URL\u3002<\/li>\n<li><strong>\u7528\u6236\u4ee3\u7406\uff1a<\/strong>\u7528\u6236\u7684\u700f\u89bd\u5668\u548c\u64cd\u4f5c\u7cfb\u7d71\u4fe1\u606f\u3002<\/li>\n<\/ul>\n<h2 id=\"%e5%a6%82%e4%bd%95%e9%85%8d%e7%bd%ae-apache-%e6%97%a5%e8%aa%8c%e6%a0%bc%e5%bc%8f-gUmlXFEGvq\">\u5982\u4f55\u914d\u7f6e Apache \u65e5\u8a8c\u683c\u5f0f<\/h2>\n<p>\u8981\u81ea\u5b9a\u7fa9 Apache \u7684\u65e5\u8a8c\u683c\u5f0f\uff0c\u53ef\u4ee5\u5728 Apache \u7684\u914d\u7f6e\u6587\u4ef6\u4e2d\u4f7f\u7528 <code>LogFormat<\/code> \u6307\u4ee4\u3002\u4ee5\u4e0b\u662f\u4e00\u500b\u793a\u4f8b\uff1a<\/p>\n<pre>\n<code>\nLogFormat \"%h %l %u %t \"%r\" %&gt;s %b \"%{Referer}i\" \"%{User-Agent}i\"\" combined\nCustomLog logs\/access_log combined\n<\/code>\n<\/pre>\n<p>\u5728\u9019\u500b\u793a\u4f8b\u4e2d\uff0c<code>LogFormat<\/code> \u5b9a\u7fa9\u4e86\u4e00\u500b\u540d\u70ba\u300ccombined\u300d\u7684\u65e5\u8a8c\u683c\u5f0f\uff0c\u7136\u5f8c\u4f7f\u7528 <code>CustomLog<\/code> \u6307\u4ee4\u5c07\u5176\u61c9\u7528\u65bc\u8a2a\u554f\u65e5\u8a8c\u3002<\/p>\n<h2 id=\"%e6%97%a5%e8%aa%8c%e5%88%86%e6%9e%90%e5%b7%a5%e5%85%b7-gUmlXFEGvq\">\u65e5\u8a8c\u5206\u6790\u5de5\u5177<\/h2>\n<p>\u5206\u6790 Apache \u65e5\u8a8c\u53ef\u4ee5\u5e6b\u52a9\u8b58\u5225\u6d41\u91cf\u6a21\u5f0f\u3001\u7528\u6236\u884c\u70ba\u548c\u6f5b\u5728\u7684\u5b89\u5168\u554f\u984c\u3002\u5e38\u7528\u7684\u65e5\u8a8c\u5206\u6790\u5de5\u5177\u5305\u62ec\uff1a<\/p>\n<ul>\n<li><strong>AWStats\uff1a<\/strong>\u4e00\u500b\u5f37\u5927\u7684\u65e5\u8a8c\u5206\u6790\u5de5\u5177\uff0c\u63d0\u4f9b\u8a73\u7d30\u7684\u5831\u544a\u548c\u5716\u8868\u3002<\/li>\n<li><strong>GoAccess\uff1a<\/strong>\u4e00\u500b\u5be6\u6642\u7684\u65e5\u8a8c\u5206\u6790\u5de5\u5177\uff0c\u652f\u6301\u591a\u7a2e\u683c\u5f0f\u3002<\/li>\n<li><strong>Webalizer\uff1a<\/strong>\u4e00\u500b\u7c21\u55ae\u6613\u7528\u7684\u65e5\u8a8c\u5206\u6790\u5de5\u5177\uff0c\u9069\u5408\u5c0f\u578b\u7db2\u7ad9\u3002<\/li>\n<\/ul>\n<h2 id=\"%e7%b8%bd%e7%b5%90-gUmlXFEGvq\">\u7e3d\u7d50<\/h2>\n<p>\u4e86\u89e3 Apache \u65e5\u8a8c\u683c\u5f0f\u5c0d\u65bc\u7ba1\u7406\u4f3a\u670d\u5668\u548c\u512a\u5316\u7db2\u7ad9\u6027\u80fd\u81f3\u95dc\u91cd\u8981\u3002\u901a\u904e\u6b63\u78ba\u914d\u7f6e\u548c\u5206\u6790\u65e5\u8a8c\uff0c\u7cfb\u7d71\u7ba1\u7406\u54e1\u53ef\u4ee5\u7372\u5f97\u6709\u95dc\u7528\u6236\u884c\u70ba\u548c\u4f3a\u670d\u5668\u72c0\u614b\u7684\u6df1\u5165\u898b\u89e3\u3002\u5982\u679c\u60a8\u6b63\u5728\u5c0b\u627e\u9ad8\u6548\u7684 <a href=\"https:\/\/server.hk\">VPS<\/a> \u89e3\u6c7a\u65b9\u6848\uff0cServer.HK \u63d0\u4f9b\u591a\u7a2e\u9078\u64c7\uff0c\u9069\u5408\u5404\u7a2e\u9700\u6c42\u3002\u7121\u8ad6\u662f <a href=\"https:\/\/server.hk\">\u9999\u6e2f\u4f3a\u670d\u5668<\/a> \u9084\u662f\u5176\u4ed6\u985e\u578b\u7684 <a href=\"https:\/\/server.hk\">\u96f2\u4f3a\u670d\u5668<\/a>\uff0c\u6211\u5011\u90fd\u80fd\u6eff\u8db3\u60a8\u7684\u9700\u6c42\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u4e86\u89e3Apache\u65e5\u5fd7\u683c\u5f0f\uff0c\u638c\u63e1\u5982\u4f55\u914d\u7f6e\u548c\u5206\u6790\u65e5\u5fd7\u6587\u4ef6\uff0c\u4ee5\u4f18\u5316\u7f51\u7ad9\u6027\u80fd\u548c\u5b89\u5168\u6027\u3002<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4924],"tags":[],"class_list":["post-41988","post","type-post","status-publish","format-standard","hentry","category-setup-tutorials"],"_links":{"self":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/41988","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/comments?post=41988"}],"version-history":[{"count":1,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/41988\/revisions"}],"predecessor-version":[{"id":41989,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/41988\/revisions\/41989"}],"wp:attachment":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/media?parent=41988"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/categories?post=41988"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/tags?post=41988"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}