{"id":107824,"date":"2024-10-29T15:12:10","date_gmt":"2024-10-29T07:12:10","guid":{"rendered":"https:\/\/lrxjmw.cn\/?p=107824"},"modified":"2024-10-29T15:12:10","modified_gmt":"2024-10-29T07:12:10","slug":"nginx-state-page","status":"publish","type":"post","link":"https:\/\/lrxjmw.cn\/nginx-state-page.html","title":{"rendered":"\u8be6\u89e3\uff1a\u914d\u7f6e\u542f\u7528NGINX\u72b6\u6001\u9875\u9762"},"content":{"rendered":"\n\n\n
\u5bfc\u8bfb<\/td>\nNginx\u662f\u4e00\u6b3e\u514d\u8d39\u7684\u5f00\u6e90\uff0c\u9ad8\u6027\u80fd\uff0c\u53ef\u9760\uff0c\u53ef\u6269\u5c55\u4e14\u53ef\u5b8c\u5168\u6269\u5c55\u7684Web\u670d\u52a1\u5668\uff0c\u8d1f\u8f7d\u5747\u8861\u5668\u548c\u53cd\u5411\u4ee3\u7406\u8f6f\u4ef6\u3002 \u5b83\u6709\u4e00\u4e2a\u7b80\u5355\u548c\u6613\u4e8e\u7406\u89e3\u7684\u914d\u7f6e\u8bed\u8a00\u3002 \u5b83\u8fd8\u652f\u6301\u591a\u79cd\u9759\u6001\u6a21\u5757\uff08\u81ea\u7b2c\u4e00\u4e2a\u7248\u672c\u5f00\u59cb\u5c31\u5b58\u5728\u4e8eNginx\u4e2d\uff09\u548c\u52a8\u6001\u6a21\u5757 \uff08\u57281.9.11\u7248\u672c\u4e2d\u5f15\u5165 \uff09\u3002<\/strong><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n

Nginx\u4e2d\u7684\u4e00\u4e2a\u91cd\u8981\u6a21\u5757\u662fngx_http_stub_status_module\u6a21\u5757\uff0c\u5b83\u901a\u8fc7\u201c \u72b6\u6001\u9875\u9762 \u201d\u63d0\u4f9b\u5bf9\u57fa\u672cNginx\u72b6\u6001\u4fe1\u606f\u7684\u8bbf\u95ee\u3002 \u5b83\u663e\u793a\u6d3b\u52a8\u5ba2\u6237\u7aef\u8fde\u63a5\u603b\u6570\uff0c\u63a5\u53d7\u548c\u5904\u7406\u7684\u603b\u6570\uff0c\u8bf7\u6c42\u603b\u6570\u4ee5\u53ca\u8bfb\u53d6\uff0c\u5199\u5165\u548c\u7b49\u5f85\u8fde\u63a5\u6570\u7b49\u4fe1\u606f\u3002<\/p>\n

\u5728\u5927\u591a\u6570Linux\u53d1\u884c\u7248\u4e0a\uff0c Nginx\u7248\u672c\u968fngx_http_stub_status_module\u542f\u7528\u3002 \u60a8\u53ef\u4ee5\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\u68c0\u67e5\u6a21\u5757\u662f\u5426\u5df2\u542f\u7528\u3002<\/p>\n

\r\n# nginx -V 2>&1 | grep -o with-http_stub_status_module\r\n\r\n\u68c0\u67e5Nginx\u72b6\u6001\u6a21\u5757\r\n<\/pre>\n

\u5982\u679c\u5728\u7ec8\u7aef\u4e2d\u770b\u5230--with-http_stub_status_module\u4f5c\u4e3a\u8f93\u51fa\uff0c\u5219\u8868\u793a\u72b6\u6001\u6a21\u5757\u5df2\u542f\u7528\u3002 \u5982\u679c\u4e0a\u8ff0\u547d\u4ee4\u6ca1\u6709\u8fd4\u56de\u4efb\u4f55\u8f93\u51fa\uff0c\u5219\u9700\u8981\u4f7f\u7528-with-http_stub_status_module\u4f5c\u4e3a\u914d\u7f6e\u53c2\u6570\u4ece\u6e90\u4ee3\u7801\u7f16\u8bd1NGINX \uff0c\u5982\u56fe\u6240\u793a\u3002<\/p>\n

\r\n# wget http:\/\/nginx.org\/download\/nginx-1.13.12.tar.gz\r\n# tar xfz nginx-1.13.12.tar.gz\r\n# cd nginx-1.13.12\/\r\n# .\/configure --with-http_stub_status_module\r\n# make\r\n# make install\r\n<\/pre>\n

\u5728\u9a8c\u8bc1\u6a21\u5757\u4e4b\u540e\uff0c\u60a8\u8fd8\u9700\u8981\u5728NGINX\u914d\u7f6e\u6587\u4ef6\/etc\/nginx\/nginx.conf\u4e2d\u542f\u7528stub_status\u6a21\u5757\uff0c\u4ee5\u4fbf\u4e3a\u8be5\u6a21\u5757\u8bbe\u7f6e\u4e00\u4e2a\u672c\u5730\u53ef\u8bbf\u95ee\u7684URL\uff08\u4f8b\u5982http:\/\/www.example.com\/nginx_status \uff09\u72b6\u6001\u9875\u9762\u3002<\/p>\n

\r\nlocation \/nginx_status {\r\nstub_status;\r\nallow 127.0.0.1;\t#only allow requests from localhost\r\ndeny all;\t\t#deny all other hosts\t\r\n}\r\n\r\n\u542f\u7528Nginx\u72b6\u6001\u9875\u9762\r\n<\/pre>\n

\u786e\u4fdd\u5c06127.0.0.1\u66ff\u6362\u4e3a\u670d\u52a1\u5668\u7684IP\u5730\u5740\uff0c\u5e76\u786e\u4fdd\u53ea\u6709\u60a8\u53ef\u8bbf\u95ee\u6b64\u9875\u9762\u3002<\/p>\n

\u66f4\u6539\u914d\u7f6e\u540e\uff0c\u8bf7\u786e\u4fdd\u68c0\u67e5nginx\u914d\u7f6e\u662f\u5426\u6709\u4efb\u4f55\u9519\u8bef\uff0c\u5e76\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\u91cd\u65b0\u542f\u52a8nginx\u670d\u52a1\u4ee5\u5b9e\u73b0\u6700\u8fd1\u7684\u66f4\u6539\u3002<\/p>\n

\r\n# nginx -t\r\n# nginx -s reload \r\n\r\n\u68c0\u67e5Nginx\u914d\u7f6e\r\n<\/pre>\n

\u91cd\u65b0\u52a0\u8f7dnginx\u670d\u52a1\u5668\u540e\uff0c\u73b0\u5728\u60a8\u53ef\u4ee5\u4f7f\u7528curl\u7a0b\u5e8f\u8bbf\u95ee\u4e0b\u9762\u7684URL\u4e2d\u7684Nginx\u72b6\u6001\u9875\u9762\u6765\u67e5\u770b\u60a8\u7684\u6307\u6807\u3002<\/p>\n

\r\n# curl http:\/\/127.0.0.1\/nginx_status\r\nOR\r\n# curl http:\/\/www.example.com\/nginx_status\r\n\r\n\u68c0\u67e5Nginx\u72b6\u6001\u9875\u9762\r\n<\/pre>\n

\u91cd\u8981\u8bf4\u660e \uff1a ngx_http_stub_status_module\u6a21\u5757\u5df2\u88abNginx 1.13.0\u7248\u672c\u4e2d\u7684ngx_http_api_module\u6a21\u5757\u53d6\u4ee3\u3002<\/p>\n

\n

\u539f\u6587\u6765\u81ea\uff1ahttps:\/\/www.howtoing.com\/enable-nginx-status-page<\/a><\/p>\n

\u672c\u6587\u5730\u5740\uff1ahttps:\/\/lrxjmw.cn\/nginx-state-page.html<\/a>\u7f16\u8f91\uff1a\u4f55\u4e91\u8273\uff0c\u5ba1\u6838\u5458\uff1a\u9004\u589e\u5b9d<\/span><\/p>\n<\/blockquote>\n","protected":false},"excerpt":{"rendered":"

\u5bfc\u8bfb Nginx\u662f\u4e00\u6b3e\u514d\u8d39\u7684\u5f00\u6e90\uff0c\u9ad8\u6027\u80fd\uff0c\u53ef\u9760\uff0c\u53ef\u6269\u5c55\u4e14\u53ef\u5b8c\u5168\u6269\u5c55\u7684Web\u670d\u52a1\u5668\uff0c\u8d1f\u8f7d\u5747\u8861\u5668\u548c\u53cd\u5411\u4ee3\u7406\u8f6f\u4ef6\u3002 […]<\/p>\n","protected":false},"author":1479,"featured_media":7920,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[55],"tags":[],"class_list":["post-107824","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-thread"],"acf":[],"_links":{"self":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/107824","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/users\/1479"}],"replies":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/comments?post=107824"}],"version-history":[{"count":8,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/107824\/revisions"}],"predecessor-version":[{"id":294036,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/107824\/revisions\/294036"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/media\/7920"}],"wp:attachment":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/media?parent=107824"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/categories?post=107824"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/tags?post=107824"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}