{"id":18023,"date":"2024-11-18T11:27:55","date_gmt":"2024-11-18T03:27:55","guid":{"rendered":"https:\/\/fwq.ai\/blog\/18023\/"},"modified":"2024-11-18T11:27:55","modified_gmt":"2024-11-18T03:27:55","slug":"%e6%80%8e%e4%b9%88%e7%9c%8bnginx%e6%98%af%e5%90%a6%e5%90%af%e5%8a%a8","status":"publish","type":"post","link":"https:\/\/fwq.ai\/blog\/18023\/","title":{"rendered":"\u600e\u4e48\u770bnginx\u662f\u5426\u542f\u52a8"},"content":{"rendered":"<blockquote><p>\n  \u8981\u67e5\u770b nginx \u662f\u5426\u5df2\u542f\u52a8\uff0c\u53ef\u4f7f\u7528\u4ee5\u4e0b\u6b65\u9aa4\uff1a\u901a\u8fc7 systemctl \u547d\u4ee4\u68c0\u67e5\u72b6\u6001\uff1asystemctl status nginx\u68c0\u67e5\u914d\u7f6e\u5e76\u67e5\u770b nginx \u662f\u5426\u6b63\u5728\u8fd0\u884c\uff1anginx -t\u68c0\u67e5 nginx \u662f\u5426\u76d1\u542c\u7aef\u53e3 80\uff1anetstat -plnt | grep nginx\n<\/p><\/blockquote>\n<p><img decoding=\"async\" src=\"https:\/\/img.php.cn\/upload\/article\/202405\/27\/2024052718452951555.jpg\" class=\"aligncenter\" title=\"\u600e\u4e48\u770bnginx\u662f\u5426\u542f\u52a8\u63d2\u56fe\" alt=\"\u600e\u4e48\u770bnginx\u662f\u5426\u542f\u52a8\u63d2\u56fe\" \/><\/p>\n<p><strong>\u5982\u4f55\u67e5\u770b Nginx \u662f\u5426\u5df2\u542f\u52a8\uff1f<\/strong><\/p>\n<p>\u8981\u67e5\u770b Nginx \u662f\u5426\u5df2\u542f\u52a8\uff0c\u8bf7\u6309\u7167\u4ee5\u4e0b\u6b65\u9aa4\u64cd\u4f5c\uff1a<\/p>\n<p><strong>\u4f7f\u7528 systemctl \u547d\u4ee4<\/strong><\/p>\n<p>\u5728\u7ec8\u7aef\u4e2d\u8fd0\u884c\u4ee5\u4e0b\u547d\u4ee4\uff1a<\/p>\n<pre>systemctl status nginx<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p><strong>\u8f93\u51fa\u89e3\u91ca\uff1a<\/strong><\/p>\n<ul>\n<li>\u5982\u679c Nginx \u6b63\u5728\u8fd0\u884c\uff0c\u8f93\u51fa\u5c06\u663e\u793a &#8220;Active: active (running)&#8221;\u3002<\/li>\n<li>\u5982\u679c Nginx \u672a\u8fd0\u884c\uff0c\u8f93\u51fa\u5c06\u663e\u793a &#8220;Active: inactive (dead)&#8221;\u3002<\/li>\n<\/ul>\n<p><strong>\u4f7f\u7528  -t \u547d\u4ee4<\/strong><\/p>\n<p>\u5728\u7ec8\u7aef\u4e2d\u8fd0\u884c\u4ee5\u4e0b\u547d\u4ee4\uff1a<\/p>\n<pre>nginx -t<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p><strong>\u8f93\u51fa\u89e3\u91ca\uff1a<\/strong><\/p>\n<ul>\n<li>\u5982\u679c Nginx \u914d\u7f6e\u6b63\u786e\u5e76\u6b63\u5728\u8fd0\u884c\uff0c\u8f93\u51fa\u5c06\u663e\u793a &#8220;the configuration file \/etc\/nginx\/nginx.conf syntax is ok&#8221;\u3002<\/li>\n<li>\u5982\u679c Nginx \u914d\u7f6e\u51fa\u73b0\u95ee\u9898\uff0c\u8f93\u51fa\u5c06\u663e\u793a\u9519\u8bef\u6d88\u606f\u3002<\/li>\n<\/ul>\n<p><strong>\u4f7f\u7528 netstat \u547d\u4ee4<\/strong><\/p>\n<p>\u5728\u7ec8\u7aef\u4e2d\u8fd0\u884c\u4ee5\u4e0b\u547d\u4ee4\uff1a<\/p>\n<pre>netstat -plnt | grep nginx<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p><strong>\u8f93\u51fa\u89e3\u91ca\uff1a<\/strong><\/p>\n<ul>\n<li>\u5982\u679c Nginx \u6b63\u5728\u76d1\u542c\u7aef\u53e3 80\uff0c\u8f93\u51fa\u5c06\u663e\u793a &#8220;tcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN&#8221;\u3002<\/li>\n<li>\u5982\u679c Nginx \u672a\u5728\u7aef\u53e3 80 \u4e0a\u76d1\u542c\uff0c\u5219\u8f93\u51fa\u5c06\u4e3a\u7a7a\u3002<\/li>\n<\/ul>\n<p>\u4ee5\u4e0a\u5c31\u662f\u600e\u4e48\u770b\u662f\u5426\u542f\u52a8\u7684\u8be6\u7ec6\u5185\u5bb9\uff0c\u66f4\u591a\u8bf7\u5173\u6ce8\u7c73\u4e91\u5176\u5b83\u76f8\u5173\u6587\u7ae0\uff01<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u8981\u67e5\u770b nginx \u662f\u5426\u5df2\u542f\u52a8\uff0c\u53ef\u4f7f\u7528\u4ee5\u4e0b\u6b65\u9aa4\uff1a\u901a\u8fc7 systemctl \u547d\u4ee4\u68c0\u67e5\u72b6\u6001\uff1asystemctl status nginx\u68c0\u67e5\u914d\u7f6e\u5e76\u67e5\u770b nginx \u662f\u5426\u6b63\u5728\u8fd0\u884c\uff1anginx -t\u68c0\u67e5 nginx \u662f\u5426\u76d1\u542c\u7aef\u53e3 80\uff1anetstat -plnt | grep nginx \u5982\u4f55\u67e5\u770b Nginx \u662f\u5426\u5df2\u542f\u52a8\uff1f \u8981\u67e5\u770b Nginx \u662f\u5426\u5df2\u542f\u52a8\uff0c\u8bf7\u6309\u7167\u4ee5\u4e0b\u6b65\u9aa4\u64cd\u4f5c\uff1a \u4f7f\u7528 systemctl \u547d\u4ee4 \u5728\u7ec8\u7aef\u4e2d\u8fd0\u884c\u4ee5\u4e0b\u547d\u4ee4\uff1a systemctl status nginx \u767b\u5f55\u540e\u590d\u5236 \u8f93\u51fa\u89e3\u91ca\uff1a \u5982\u679c Nginx \u6b63\u5728\u8fd0\u884c\uff0c\u8f93\u51fa\u5c06\u663e\u793a &#8220;Active: active (running)&#8221;\u3002 \u5982\u679c Nginx \u672a\u8fd0\u884c\uff0c\u8f93\u51fa\u5c06\u663e\u793a &#8220;Active: inactive (dead)&#8221;\u3002 \u4f7f\u7528 -t \u547d\u4ee4 \u5728\u7ec8\u7aef\u4e2d\u8fd0\u884c\u4ee5\u4e0b\u547d\u4ee4\uff1a nginx -t \u767b\u5f55\u540e\u590d\u5236 \u8f93\u51fa\u89e3\u91ca\uff1a \u5982\u679c Nginx \u914d\u7f6e\u6b63\u786e\u5e76\u6b63\u5728\u8fd0\u884c\uff0c\u8f93\u51fa\u5c06\u663e\u793a [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[8],"tags":[],"class_list":["post-18023","post","type-post","status-publish","format-standard","hentry","category-os"],"_links":{"self":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/18023","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/comments?post=18023"}],"version-history":[{"count":0,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/18023\/revisions"}],"wp:attachment":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/media?parent=18023"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/categories?post=18023"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/tags?post=18023"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}