{"id":63550,"date":"2025-04-29T09:32:01","date_gmt":"2025-04-29T01:32:01","guid":{"rendered":"https:\/\/fwq.ai\/blog\/63550\/"},"modified":"2025-04-29T09:32:01","modified_gmt":"2025-04-29T01:32:01","slug":"nginx%e8%bf%90%e8%a1%8c%e7%8a%b6%e6%80%81%e6%80%8e%e4%b9%88%e6%9f%a5%e7%9c%8b-2","status":"publish","type":"post","link":"https:\/\/fwq.ai\/blog\/63550\/","title":{"rendered":"nginx\u8fd0\u884c\u72b6\u6001\u600e\u4e48\u67e5\u770b"},"content":{"rendered":"<blockquote><p>\n  \u53ef\u4ee5\u901a\u8fc7\u4ee5\u4e0b\u65b9\u6cd5\u67e5\u770b nginx \u8fd0\u884c\u72b6\u6001\uff1anginx -t\uff1a\u68c0\u67e5\u914d\u7f6e\u6587\u4ef6\u8bed\u6cd5\u662f\u5426\u6b63\u786e\u3002nginx -v\uff1a\u663e\u793a nginx \u7248\u672c\u548c\u5176\u4ed6\u7f16\u8bd1\u4fe1\u606f\u3002service nginx status\uff1a\u67e5\u770b nginx \u670d\u52a1\u7684\u8fd0\u884c\u72b6\u6001\uff08\u9002\u7528\u4e8e linux \u7cfb\u7edf\uff09\u3002ps -ef | grep nginx\uff1a\u67e5\u627e\u6b63\u5728\u8fd0\u884c\u7684 nginx \u8fdb\u7a0b\u3002netstat -nlp | grep nginx\uff1a\u67e5\u770b nginx \u76d1\u542c\u7684\u7aef\u53e3\u548c\u5730\u5740\u3002\n<\/p><\/blockquote>\n<p><img decoding=\"async\" src=\"https:\/\/img.php.cn\/upload\/article\/202405\/27\/2024052719482138627.jpg\" class=\"aligncenter\" title=\"nginx\u8fd0\u884c\u72b6\u6001\u600e\u4e48\u67e5\u770b\u63d2\u56fe\" alt=\"nginx\u8fd0\u884c\u72b6\u6001\u600e\u4e48\u67e5\u770b\u63d2\u56fe\" \/><\/p>\n<p><strong> \u8fd0\u884c\u72b6\u6001\u67e5\u770b<\/strong><\/p>\n<p><strong>\u5982\u4f55\u67e5\u770b nginx \u8fd0\u884c\u72b6\u6001\uff1f<\/strong><\/p>\n<p>\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\u4e4b\u4e00\uff1a<\/p>\n<ul>\n<li>nginx -t: \u68c0\u67e5 nginx \u914d\u7f6e\u6587\u4ef6\u8bed\u6cd5\u662f\u5426\u6b63\u786e\uff0c\u800c\u4e0d\u542f\u52a8 nginx\u3002<\/li>\n<li>nginx -V: \u663e\u793a nginx \u7248\u672c\u548c\u5176\u4ed6\u7f16\u8bd1\u4fe1\u606f\uff0c\u800c\u4e0d\u542f\u52a8 nginx\u3002<\/li>\n<li>service nginx status: \u67e5\u770b\u7cfb\u7edf\u670d\u52a1\u4e2d nginx \u7684\u8fd0\u884c\u72b6\u6001\uff08\u9002\u7528\u4e8e Linux \u7cfb\u7edf\uff09\u3002<\/li>\n<li>ps -ef | grep nginx: \u67e5\u627e\u6240\u6709\u6b63\u5728\u8fd0\u884c\u7684 nginx \u8fdb\u7a0b\uff0c\u5e76\u663e\u793a\u5176\u72b6\u6001\u548c\u5176\u4ed6\u4fe1\u606f\u3002<\/li>\n<li>netstat -nlp | grep nginx: \u67e5\u770b nginx \u6b63\u5728\u76d1\u542c\u54ea\u4e9b\u7aef\u53e3\u548c\u5730\u5740\u3002<\/li>\n<\/ul>\n<p><strong>\u8be6\u7ec6\u89e3\u91ca\uff1a<\/strong><\/p>\n<p><strong>nginx -t<\/strong><\/p>\n<p>\u6b64\u547d\u4ee4\u68c0\u67e5 nginx \u914d\u7f6e\u6587\u4ef6\uff08\u901a\u5e38\u4f4d\u4e8e \/etc\/nginx\/nginx.conf\uff09\u7684\u8bed\u6cd5\u3002\u5982\u679c\u914d\u7f6e\u6587\u4ef6\u6b63\u786e\uff0c\u5c06\u663e\u793a\u4ee5\u4e0b\u6d88\u606f\uff1a<\/p>\n<pre>nginx: the configuration file \/etc\/nginx\/nginx.conf syntax is ok\nnginx: configuration file \/etc\/nginx\/nginx.conf test is successful<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p><strong>nginx -V<\/strong><\/p>\n<p>\u6b64\u547d\u4ee4\u663e\u793a nginx \u7248\u672c\u4ee5\u53ca\u6709\u5173\u5176\u7f16\u8bd1\u9009\u9879\u548c\u5176\u4ed6\u4fe1\u606f\u3002<\/p>\n<p><strong>service nginx status<\/strong><\/p>\n<p>\u6b64\u547d\u4ee4\u9002\u7528\u4e8e Linux \u7cfb\u7edf\uff0c\u5b83\u663e\u793a nginx \u670d\u52a1\u7684\u8fd0\u884c\u72b6\u6001\u3002\u8f93\u51fa\u901a\u5e38\u5982\u4e0b\u6240\u793a\uff1a<\/p>\n<pre>nginx is running (pid 12345)<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p><strong>ps -ef | grep nginx<\/strong><\/p>\n<p>\u6b64\u547d\u4ee4\u663e\u793a\u7cfb\u7edf\u4e2d\u6240\u6709\u6b63\u5728\u8fd0\u884c\u7684 nginx \u8fdb\u7a0b\u3002\u8f93\u51fa\u7c7b\u4f3c\u4e8e\uff1a<\/p>\n<pre>root      12345  15122 15:02 ?        00:00:05 nginx: master process \/usr\/sbin\/nginx -g daemon on; master_process on;\nroot      12346  15125 15:02 ?        00:00:00 nginx: worker process<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p><strong>netstat -nlp | grep nginx<\/strong><\/p>\n<p>\u6b64\u547d\u4ee4\u663e\u793a nginx \u76d1\u542c\u7684\u7aef\u53e3\u548c\u5730\u5740\u3002\u8f93\u51fa\u901a\u5e38\u5982\u4e0b\u6240\u793a\uff1a<\/p>\n<pre>tcp        0      0 0.0.0.0:80             0.0.0.0:*               LISTEN\ntcp        0      0 :::80                  :::*                    LISTEN<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p>\u4ee5\u4e0a\u5c31\u662f\u8fd0\u884c\u72b6\u6001\u600e\u4e48\u67e5\u770b\u7684\u8be6\u7ec6\u5185\u5bb9\uff0c\u66f4\u591a\u8bf7\u5173\u6ce8FDCServers\u5176\u5b83\u76f8\u5173\u6587\u7ae0\uff01<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u53ef\u4ee5\u901a\u8fc7\u4ee5\u4e0b\u65b9\u6cd5\u67e5\u770b nginx \u8fd0\u884c\u72b6\u6001\uff1anginx -t\uff1a\u68c0\u67e5\u914d\u7f6e\u6587\u4ef6\u8bed\u6cd5\u662f\u5426\u6b63\u786e\u3002nginx -v\uff1a\u663e\u793a nginx \u7248\u672c\u548c\u5176\u4ed6\u7f16\u8bd1\u4fe1\u606f\u3002service nginx status\uff1a\u67e5\u770b nginx \u670d\u52a1\u7684\u8fd0\u884c\u72b6\u6001\uff08\u9002\u7528\u4e8e linux \u7cfb\u7edf\uff09\u3002ps -ef | grep nginx\uff1a\u67e5\u627e\u6b63\u5728\u8fd0\u884c\u7684 nginx \u8fdb\u7a0b\u3002netstat -nlp | grep nginx\uff1a\u67e5\u770b nginx \u76d1\u542c\u7684\u7aef\u53e3\u548c\u5730\u5740\u3002 \u8fd0\u884c\u72b6\u6001\u67e5\u770b \u5982\u4f55\u67e5\u770b nginx \u8fd0\u884c\u72b6\u6001\uff1f \u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\u4e4b\u4e00\uff1a nginx -t: \u68c0\u67e5 nginx \u914d\u7f6e\u6587\u4ef6\u8bed\u6cd5\u662f\u5426\u6b63\u786e\uff0c\u800c\u4e0d\u542f\u52a8 nginx\u3002 nginx -V: \u663e\u793a nginx \u7248\u672c\u548c\u5176\u4ed6\u7f16\u8bd1\u4fe1\u606f\uff0c\u800c\u4e0d\u542f\u52a8 nginx\u3002 service nginx status: \u67e5\u770b\u7cfb\u7edf\u670d\u52a1\u4e2d nginx \u7684\u8fd0\u884c\u72b6\u6001\uff08\u9002\u7528\u4e8e Linux \u7cfb\u7edf\uff09\u3002 ps -ef | grep nginx: [&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-63550","post","type-post","status-publish","format-standard","hentry","category-os"],"_links":{"self":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/63550","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=63550"}],"version-history":[{"count":0,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/63550\/revisions"}],"wp:attachment":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/media?parent=63550"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/categories?post=63550"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/tags?post=63550"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}