{"id":41592,"date":"2024-10-02T00:27:31","date_gmt":"2024-10-01T16:27:31","guid":{"rendered":"https:\/\/server.hk\/cnblog\/41592\/"},"modified":"2024-10-02T00:27:31","modified_gmt":"2024-10-01T16:27:31","slug":"apache%e6%96%b0%e6%89%8b%e6%95%99%e7%a8%8b%ef%bc%9a%e8%a8%ad%e5%ae%9aapache%e8%88%87mod_status-2","status":"publish","type":"post","link":"https:\/\/server.hk\/cnblog\/41592\/","title":{"rendered":"Apache\u65b0\u624b\u6559\u7a0b\uff1a\u8a2d\u5b9aApache\u8207mod_status"},"content":{"rendered":"<h1 id=\"apache%e6%96%b0%e6%89%8b%e6%95%99%e7%a8%8b%ef%bc%9a%e8%a8%ad%e5%ae%9aapache%e8%88%87mod_status-EgowndOFyP\">Apache\u65b0\u624b\u6559\u7a0b\uff1a\u8a2d\u5b9aApache\u8207mod_status<\/h1>\n<p>Apache HTTP Server\uff08\u7c21\u7a31Apache\uff09\u662f\u6700\u6d41\u884c\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\u5c0d\u65bc\u65b0\u624b\u4f86\u8aaa\uff0c\u5b78\u6703\u5982\u4f55\u8a2d\u5b9aApache\u53ca\u5176\u6a21\u7d44\u662f\u975e\u5e38\u91cd\u8981\u7684\u3002\u672c\u6587\u5c07\u4ecb\u7d39\u5982\u4f55\u5b89\u88ddApache\u3001\u555f\u7528mod_status\u6a21\u7d44\uff0c\u4e26\u9032\u884c\u57fa\u672c\u7684\u8a2d\u5b9a\u3002<\/p>\n<h2 id=\"%e5%ae%89%e8%a3%9dapache-EgowndOFyP\">\u5b89\u88ddApache<\/h2>\n<p>\u5728\u5927\u591a\u6578Linux\u767c\u884c\u7248\u4e2d\uff0c\u5b89\u88ddApache\u975e\u5e38\u7c21\u55ae\u3002\u4ee5\u4e0b\u662f\u57fa\u65bcUbuntu\u548cCentOS\u7684\u5b89\u88dd\u6b65\u9a5f\uff1a<\/p>\n<h3 id=\"%e5%9c%a8ubuntu%e4%b8%8a%e5%ae%89%e8%a3%9dapache-EgowndOFyP\">\u5728Ubuntu\u4e0a\u5b89\u88ddApache<\/h3>\n<pre><code>sudo apt update\nsudo apt install apache2\n<\/code><\/pre>\n<h3 id=\"%e5%9c%a8centos%e4%b8%8a%e5%ae%89%e8%a3%9dapache-EgowndOFyP\">\u5728CentOS\u4e0a\u5b89\u88ddApache<\/h3>\n<pre><code>sudo yum update\nsudo yum install httpd\n<\/code><\/pre>\n<p>\u5b89\u88dd\u5b8c\u6210\u5f8c\uff0c\u53ef\u4ee5\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\u555f\u52d5Apache\u670d\u52d9\uff1a<\/p>\n<pre><code>sudo systemctl start apache2  # Ubuntu\nsudo systemctl start httpd      # CentOS\n<\/code><\/pre>\n<p>\u8981\u78ba\u4fddApache\u5728\u7cfb\u7d71\u555f\u52d5\u6642\u81ea\u52d5\u555f\u52d5\uff0c\u53ef\u4ee5\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\uff1a<\/p>\n<pre><code>sudo systemctl enable apache2  # Ubuntu\nsudo systemctl enable httpd      # CentOS\n<\/code><\/pre>\n<h2 id=\"%e5%95%9f%e7%94%a8mod_status%e6%a8%a1%e7%b5%84-EgowndOFyP\">\u555f\u7528mod_status\u6a21\u7d44<\/h2>\n<p>mod_status\u662f\u4e00\u500bApache\u6a21\u7d44\uff0c\u5141\u8a31\u7528\u6236\u67e5\u770b\u4f3a\u670d\u5668\u7684\u7576\u524d\u72c0\u614b\uff0c\u5305\u62ec\u6d3b\u52d5\u9023\u63a5\u3001\u8acb\u6c42\u6578\u91cf\u7b49\u3002\u8981\u555f\u7528mod_status\uff0c\u8acb\u6309\u7167\u4ee5\u4e0b\u6b65\u9a5f\u64cd\u4f5c\uff1a<\/p>\n<h3 id=\"%e5%95%9f%e7%94%a8mod_status-EgowndOFyP\">\u555f\u7528mod_status<\/h3>\n<p>\u5728Ubuntu\u4e0a\uff0c\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\u555f\u7528mod_status\uff1a<\/p>\n<pre><code>sudo a2enmod status\n<\/code><\/pre>\n<p>\u5728CentOS\u4e0a\uff0cmod_status\u901a\u5e38\u662f\u9810\u8a2d\u555f\u7528\u7684\u3002\u5982\u679c\u672a\u555f\u7528\uff0c\u53ef\u4ee5\u5728Apache\u7684\u914d\u7f6e\u6587\u4ef6\u4e2d\u624b\u52d5\u6dfb\u52a0\uff1a<\/p>\n<pre><code>LoadModule status_module modules\/mod_status.so\n<\/code><\/pre>\n<h3 id=\"%e9%85%8d%e7%bd%aemod_status-EgowndOFyP\">\u914d\u7f6emod_status<\/h3>\n<p>\u63a5\u4e0b\u4f86\uff0c\u9700\u8981\u914d\u7f6emod_status\u7684\u8a2a\u554f\u6b0a\u9650\u3002\u6253\u958bApache\u7684\u914d\u7f6e\u6587\u4ef6\uff0c\u901a\u5e38\u4f4d\u65bc\u4ee5\u4e0b\u8def\u5f91\uff1a<\/p>\n<ul>\n<li>Ubuntu: \/etc\/apache2\/apache2.conf<\/li>\n<li>CentOS: \/etc\/httpd\/conf\/httpd.conf<\/li>\n<\/ul>\n<p>\u5728\u6587\u4ef6\u4e2d\u6dfb\u52a0\u4ee5\u4e0b\u914d\u7f6e\uff1a<\/p>\n<pre><code>&lt;Location \/server-status&gt;\n    SetHandler server-status\n    Require host localhost\n    &lt;\/Location&gt;\n<\/code><\/pre>\n<p>\u9019\u6bb5\u914d\u7f6e\u5141\u8a31\u4f86\u81ea\u672c\u5730\u4e3b\u6a5f\u7684\u8acb\u6c42\u8a2a\u554f\/server-status\u9801\u9762\u3002\u60a8\u53ef\u4ee5\u6839\u64da\u9700\u8981\u8abf\u6574\u8a2a\u554f\u6b0a\u9650\uff0c\u4f8b\u5982\u5141\u8a31\u7279\u5b9aIP\u5730\u5740\u3002<\/p>\n<h2 id=\"%e9%87%8d%e5%95%9fapache%e6%9c%8d%e5%8b%99-EgowndOFyP\">\u91cd\u555fApache\u670d\u52d9<\/h2>\n<p>\u5b8c\u6210\u914d\u7f6e\u5f8c\uff0c\u5fc5\u9808\u91cd\u555fApache\u670d\u52d9\u4ee5\u4f7f\u66f4\u6539\u751f\u6548\uff1a<\/p>\n<pre><code>sudo systemctl restart apache2  # Ubuntu\nsudo systemctl restart httpd      # CentOS\n<\/code><\/pre>\n<h2 id=\"%e6%9f%a5%e7%9c%8b%e4%bc%ba%e6%9c%8d%e5%99%a8%e7%8b%80%e6%85%8b-EgowndOFyP\">\u67e5\u770b\u4f3a\u670d\u5668\u72c0\u614b<\/h2>\n<p>\u73fe\u5728\uff0c\u60a8\u53ef\u4ee5\u901a\u904e\u700f\u89bd\u5668\u8a2a\u554f\u4ee5\u4e0bURL\u4f86\u67e5\u770b\u4f3a\u670d\u5668\u72c0\u614b\uff1a<\/p>\n<pre><code>http:\/\/localhost\/server-status\n<\/code><\/pre>\n<p>\u5982\u679c\u4e00\u5207\u6b63\u5e38\uff0c\u60a8\u5c07\u770b\u5230\u4e00\u500b\u986f\u793a\u4f3a\u670d\u5668\u7576\u524d\u72c0\u614b\u7684\u9801\u9762\uff0c\u5305\u62ec\u6d3b\u52d5\u9023\u63a5\u3001\u8acb\u6c42\u6578\u91cf\u7b49\u4fe1\u606f\u3002<\/p>\n<h2 id=\"%e7%b8%bd%e7%b5%90-EgowndOFyP\">\u7e3d\u7d50<\/h2>\n<p>\u672c\u6587\u4ecb\u7d39\u4e86\u5982\u4f55\u5b89\u88ddApache\u3001\u555f\u7528mod_status\u6a21\u7d44\u4ee5\u53ca\u9032\u884c\u57fa\u672c\u7684\u914d\u7f6e\u3002\u9019\u4e9b\u6b65\u9a5f\u5c0d\u65bc\u65b0\u624b\u4f86\u8aaa\u662f\u975e\u5e38\u91cd\u8981\u7684\uff0c\u80fd\u5920\u5e6b\u52a9\u60a8\u66f4\u597d\u5730\u7ba1\u7406\u548c\u76e3\u63a7\u60a8\u7684\u4f3a\u670d\u5668\u3002\u5982\u679c\u60a8\u9700\u8981\u66f4\u9ad8\u6548\u7684\u4f3a\u670d\u5668\u89e3\u6c7a\u65b9\u6848\uff0c\u8003\u616e\u4f7f\u7528<a href=\"https:\/\/server.hk\">\u9999\u6e2fVPS<\/a>\u6216<a href=\"https:\/\/server.hk\">\u9999\u6e2f\u4f3a\u670d\u5668<\/a>\uff0c\u4ee5\u6eff\u8db3\u60a8\u7684\u9700\u6c42\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u5b78\u7fd2\u5982\u4f55\u8a2d\u5b9aApache\u4f3a\u670d\u5668\u8207mod_status\u6a21\u7d44\uff0c\u638c\u63e1\u57fa\u672c\u914d\u7f6e\uff0c\u63d0\u5347\u7db2\u7ad9\u6027\u80fd\u8207\u76e3\u63a7\u80fd\u529b\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-41592","post","type-post","status-publish","format-standard","hentry","category-setup-tutorials"],"_links":{"self":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/41592","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=41592"}],"version-history":[{"count":1,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/41592\/revisions"}],"predecessor-version":[{"id":41593,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/41592\/revisions\/41593"}],"wp:attachment":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/media?parent=41592"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/categories?post=41592"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/tags?post=41592"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}