{"id":51151,"date":"2024-10-08T16:27:15","date_gmt":"2024-10-08T08:27:15","guid":{"rendered":"https:\/\/server.hk\/cnblog\/51151\/"},"modified":"2024-10-08T16:27:15","modified_gmt":"2024-10-08T08:27:15","slug":"%e6%80%8e%e9%ba%bc%e9%97%9c%e9%96%89%e9%9b%b2%e4%bc%ba%e6%9c%8d%e5%99%a8-nginx-%e6%9c%8d%e5%8b%99","status":"publish","type":"post","link":"https:\/\/server.hk\/cnblog\/51151\/","title":{"rendered":"\u600e\u9ebc\u95dc\u9589\u96f2\u4f3a\u670d\u5668 nginx \u670d\u52d9"},"content":{"rendered":"<h1 id=\"%e6%80%8e%e9%ba%bc%e9%97%9c%e9%96%89%e9%9b%b2%e4%bc%ba%e6%9c%8d%e5%99%a8-nginx-%e6%9c%8d%e5%8b%99-nIUCyqnvhq\">\u600e\u9ebc\u95dc\u9589\u96f2\u4f3a\u670d\u5668 Nginx \u670d\u52d9<\/h1>\n<p>Nginx \u662f\u4e00\u6b3e\u9ad8\u6548\u80fd\u7684\u7db2\u9801\u4f3a\u670d\u5668\uff0c\u5ee3\u6cdb\u61c9\u7528\u65bc\u5404\u7a2e\u7db2\u7ad9\u548c\u61c9\u7528\u7a0b\u5f0f\u4e2d\u3002\u7576\u60a8\u9700\u8981\u9032\u884c\u7dad\u8b77\u3001\u66f4\u65b0\u6216\u662f\u5176\u4ed6\u64cd\u4f5c\u6642\uff0c\u53ef\u80fd\u9700\u8981\u66ab\u6642\u95dc\u9589 Nginx \u670d\u52d9\u3002\u672c\u6587\u5c07\u8a73\u7d30\u4ecb\u7d39\u5982\u4f55\u5728\u96f2\u4f3a\u670d\u5668\u4e0a\u95dc\u9589 Nginx \u670d\u52d9\u7684\u6b65\u9a5f\u3002<\/p>\n<h2 id=\"%e6%aa%a2%e6%9f%a5-nginx-%e6%9c%8d%e5%8b%99%e7%8b%80%e6%85%8b-nIUCyqnvhq\">\u6aa2\u67e5 Nginx \u670d\u52d9\u72c0\u614b<\/h2>\n<p>\u5728\u95dc\u9589 Nginx \u670d\u52d9\u4e4b\u524d\uff0c\u9996\u5148\u9700\u8981\u78ba\u8a8d\u5176\u7576\u524d\u7684\u904b\u884c\u72c0\u614b\u3002\u60a8\u53ef\u4ee5\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\u4f86\u6aa2\u67e5 Nginx \u7684\u72c0\u614b\uff1a<\/p>\n<pre><code>sudo systemctl status nginx<\/code><\/pre>\n<p>\u5982\u679c Nginx \u6b63\u5728\u904b\u884c\uff0c\u60a8\u5c07\u770b\u5230\u985e\u4f3c\u65bc\u4ee5\u4e0b\u7684\u8f38\u51fa\uff1a<\/p>\n<pre><code>\u25cf nginx.service - A high performance web server and a reverse proxy server\n   Loaded: loaded (\/lib\/systemd\/system\/nginx.service; enabled; vendor preset: enabled)\n   Active: active (running) ...<\/code><\/pre>\n<h2 id=\"%e9%97%9c%e9%96%89-nginx-%e6%9c%8d%e5%8b%99-nIUCyqnvhq\">\u95dc\u9589 Nginx \u670d\u52d9<\/h2>\n<p>\u8981\u95dc\u9589 Nginx \u670d\u52d9\uff0c\u60a8\u53ef\u4ee5\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\uff1a<\/p>\n<pre><code>sudo systemctl stop nginx<\/code><\/pre>\n<p>\u57f7\u884c\u6b64\u547d\u4ee4\u5f8c\uff0c\u60a8\u53ef\u4ee5\u518d\u6b21\u6aa2\u67e5 Nginx \u7684\u72c0\u614b\uff0c\u4ee5\u78ba\u4fdd\u5176\u5df2\u6210\u529f\u95dc\u9589\uff1a<\/p>\n<pre><code>sudo systemctl status nginx<\/code><\/pre>\n<p>\u6b64\u6642\uff0c\u60a8\u61c9\u8a72\u6703\u770b\u5230 Nginx \u7684\u72c0\u614b\u986f\u793a\u70ba\u300cinactive (dead)\u300d\u3002<\/p>\n<h2 id=\"%e7%a6%81%e7%94%a8-nginx-%e6%9c%8d%e5%8b%99%ef%bc%88%e5%8f%af%e9%81%b8%ef%bc%89-nIUCyqnvhq\">\u7981\u7528 Nginx \u670d\u52d9\uff08\u53ef\u9078\uff09<\/h2>\n<p>\u5982\u679c\u60a8\u5e0c\u671b\u5728\u7cfb\u7d71\u555f\u52d5\u6642\u4e0d\u81ea\u52d5\u555f\u52d5 Nginx \u670d\u52d9\uff0c\u53ef\u4ee5\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\u7981\u7528\u5b83\uff1a<\/p>\n<pre><code>sudo systemctl disable nginx<\/code><\/pre>\n<p>\u9019\u6a23\uff0cNginx \u5c07\u4e0d\u6703\u5728\u6bcf\u6b21\u91cd\u555f\u4f3a\u670d\u5668\u6642\u81ea\u52d5\u555f\u52d5\u3002<\/p>\n<h2 id=\"%e9%87%8d%e6%96%b0%e5%95%9f%e5%8b%95-nginx-%e6%9c%8d%e5%8b%99-nIUCyqnvhq\">\u91cd\u65b0\u555f\u52d5 Nginx \u670d\u52d9<\/h2>\n<p>\u5982\u679c\u60a8\u9700\u8981\u91cd\u65b0\u555f\u52d5 Nginx \u670d\u52d9\uff0c\u53ef\u4ee5\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\uff1a<\/p>\n<pre><code>sudo systemctl start nginx<\/code><\/pre>\n<p>\u540c\u6a23\uff0c\u60a8\u53ef\u4ee5\u6aa2\u67e5\u5176\u72c0\u614b\u4ee5\u78ba\u8a8d Nginx \u662f\u5426\u5df2\u6210\u529f\u555f\u52d5\uff1a<\/p>\n<pre><code>sudo systemctl status nginx<\/code><\/pre>\n<h2 id=\"%e5%85%b6%e4%bb%96%e7%9b%b8%e9%97%9c%e5%91%bd%e4%bb%a4-nIUCyqnvhq\">\u5176\u4ed6\u76f8\u95dc\u547d\u4ee4<\/h2>\n<p>\u9664\u4e86\u4e0a\u8ff0\u57fa\u672c\u547d\u4ee4\u5916\uff0c\u9084\u6709\u4e00\u4e9b\u5176\u4ed6\u6709\u7528\u7684\u547d\u4ee4\u53ef\u4ee5\u5e6b\u52a9\u60a8\u7ba1\u7406 Nginx \u670d\u52d9\uff1a<\/p>\n<ul>\n<li><strong>\u91cd\u65b0\u52a0\u8f09\u914d\u7f6e\uff1a<\/strong>\u5982\u679c\u60a8\u5c0d Nginx \u7684\u914d\u7f6e\u6587\u4ef6\u9032\u884c\u4e86\u66f4\u6539\uff0c\u53ef\u4ee5\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\u91cd\u65b0\u52a0\u8f09\u914d\u7f6e\uff0c\u800c\u4e0d\u9700\u8981\u5b8c\u5168\u505c\u6b62\u670d\u52d9\uff1a<\/li>\n<pre><code>sudo systemctl reload nginx<\/code><\/pre>\n<li><strong>\u67e5\u770b Nginx \u932f\u8aa4\u65e5\u8a8c\uff1a<\/strong>\u5982\u679c\u5728\u904b\u884c Nginx \u6642\u9047\u5230\u554f\u984c\uff0c\u53ef\u4ee5\u67e5\u770b\u932f\u8aa4\u65e5\u8a8c\u4ee5\u7372\u53d6\u66f4\u591a\u4fe1\u606f\uff1a<\/li>\n<pre><code>sudo tail -f \/var\/log\/nginx\/error.log<\/code><\/pre>\n<\/ul>\n<h2 id=\"%e7%b8%bd%e7%b5%90-nIUCyqnvhq\">\u7e3d\u7d50<\/h2>\n<p>\u95dc\u9589 Nginx \u670d\u52d9\u662f\u4e00\u500b\u7c21\u55ae\u7684\u904e\u7a0b\uff0c\u53ea\u9700\u5e7e\u500b\u547d\u4ee4\u5373\u53ef\u5b8c\u6210\u3002\u7121\u8ad6\u662f\u9032\u884c\u7dad\u8b77\u9084\u662f\u66f4\u65b0\uff0c\u4e86\u89e3\u5982\u4f55\u7ba1\u7406 Nginx \u670d\u52d9\u5c0d\u65bc\u96f2\u4f3a\u670d\u5668\u7684\u904b\u884c\u81f3\u95dc\u91cd\u8981\u3002\u5982\u679c\u60a8\u6b63\u5728\u5c0b\u627e\u9ad8\u6548\u80fd\u7684 <a href=\"https:\/\/server.hk\">\u9999\u6e2fVPS<\/a> \u89e3\u6c7a\u65b9\u6848\uff0cServer.HK \u63d0\u4f9b\u591a\u7a2e\u9078\u64c7\uff0c\u6eff\u8db3\u60a8\u7684\u9700\u6c42\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u5b78\u7fd2\u5982\u4f55\u95dc\u9589\u96f2\u4f3a\u670d\u5668\u4e0a\u7684 Nginx \u670d\u52d9\uff0c\u7c21\u55ae\u6b65\u9a5f\u6559\u4f60\u5feb\u901f\u5b8c\u6210\uff0c\u78ba\u4fdd\u4f3a\u670d\u5668\u5b89\u5168\u8207\u7a69\u5b9a\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-51151","post","type-post","status-publish","format-standard","hentry","category-setup-tutorials"],"_links":{"self":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/51151","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=51151"}],"version-history":[{"count":1,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/51151\/revisions"}],"predecessor-version":[{"id":51152,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/51151\/revisions\/51152"}],"wp:attachment":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/media?parent=51151"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/categories?post=51151"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/tags?post=51151"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}