{"id":18004,"date":"2024-11-18T17:55:15","date_gmt":"2024-11-18T09:55:15","guid":{"rendered":"https:\/\/fwq.ai\/blog\/18004\/"},"modified":"2024-11-18T17:55:15","modified_gmt":"2024-11-18T09:55:15","slug":"linux%e6%80%8e%e4%b9%88%e5%90%af%e5%8a%a8nginx","status":"publish","type":"post","link":"https:\/\/fwq.ai\/blog\/18004\/","title":{"rendered":"linux\u600e\u4e48\u542f\u52a8nginx"},"content":{"rendered":"<blockquote><p>\n  \u5728 linux \u4e2d\u542f\u52a8 nginx \u7684\u6b65\u9aa4\uff1a\u68c0\u67e5 nginx \u662f\u5426\u5df2\u5b89\u88c5\u3002\u4f7f\u7528 systemctl start nginx \u542f\u52a8 nginx \u670d\u52a1\u3002\u4f7f\u7528 systemctl enable nginx \u542f\u7528\u5728\u7cfb\u7edf\u542f\u52a8\u65f6\u81ea\u52a8\u542f\u52a8 nginx\u3002\u4f7f\u7528 systemctl status nginx \u9a8c\u8bc1\u542f\u52a8\u662f\u5426\u6210\u529f\u3002\u5728 web \u6d4f\u89c8\u5668\u4e2d\u8bbf\u95ee http:\/\/localhost \u67e5\u770b\u9ed8\u8ba4\u6b22\u8fce\u9875\u9762\u3002\n<\/p><\/blockquote>\n<p><img decoding=\"async\" src=\"https:\/\/img.php.cn\/upload\/article\/202405\/27\/2024052717242017066.jpg\" class=\"aligncenter\" title=\"linux\u600e\u4e48\u542f\u52a8nginx\u63d2\u56fe\" alt=\"linux\u600e\u4e48\u542f\u52a8nginx\u63d2\u56fe\" \/><\/p>\n<p><strong>\u5982\u4f55\u5728 Linux \u4e2d\u542f\u52a8 Nginx<\/strong><\/p>\n<p>\u8981\u5728 Linux \u4e2d\u542f\u52a8 Nginx\uff0c\u8bf7\u6267\u884c\u4ee5\u4e0b\u6b65\u9aa4\uff1a<\/p>\n<p><strong>1. \u68c0\u67e5 Nginx \u662f\u5426\u5df2\u5b89\u88c5<\/strong><\/p>\n<p>\u68c0\u67e5 Nginx \u662f\u5426\u5df2\u7ecf\u5b89\u88c5\u5728\u7cfb\u7edf\u4e0a\uff1a<\/p>\n<pre>$ systemctl status nginx<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p>\u5982\u679c Nginx \u5df2\u5b89\u88c5\uff0c\u5b83\u5c06\u663e\u793a\u201cactive (running)\u201d\u3002<\/p>\n<p><strong>2. \u542f\u52a8 Nginx \u670d\u52a1<\/strong><\/p>\n<p>\u5982\u679c Nginx \u672a\u8fd0\u884c\u6216\u5df2\u505c\u6b62\uff0c\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\u542f\u52a8\u5b83\uff1a<\/p>\n<pre>$ systemctl start nginx<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p><strong>3. \u542f\u7528 Nginx \u968f\u7cfb\u7edf\u542f\u52a8<\/strong><\/p>\n<p>\u8981\u4f7f Nginx \u5728\u7cfb\u7edf\u542f\u52a8\u65f6\u81ea\u52a8\u542f\u52a8\uff0c\u8bf7\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\u542f\u7528\u5b83\uff1a<\/p>\n<pre>$ systemctl enable nginx<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p><strong>4. \u9a8c\u8bc1 Nginx \u662f\u5426\u5df2\u542f\u52a8<\/strong><\/p>\n<p>\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\u9a8c\u8bc1 Nginx \u662f\u5426\u5df2\u6210\u529f\u542f\u52a8\uff1a<\/p>\n<pre>$ systemctl status nginx<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p>\u5b83\u5e94\u8be5\u663e\u793a\u201cactive (running)\u201d\u3002<\/p>\n<p><strong>5. \u8bbf\u95ee Nginx \u9ed8\u8ba4\u9875\u9762<\/strong><\/p>\n<p>\u5728 Web \u6d4f\u89c8\u5668\u4e2d\u6253\u5f00\u4ee5\u4e0b URL\uff0c\u4ee5\u9a8c\u8bc1 Nginx \u662f\u5426\u6b63\u5728\u8fd0\u884c\uff1a<\/p>\n<pre>http:\/\/localhost<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p>\u60a8\u5e94\u8be5\u770b\u5230 Nginx \u9ed8\u8ba4\u6b22\u8fce\u9875\u9762\u3002<\/p>\n<p>\u4ee5\u4e0a\u5c31\u662f\u600e\u4e48\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>\u5728 linux \u4e2d\u542f\u52a8 nginx \u7684\u6b65\u9aa4\uff1a\u68c0\u67e5 nginx \u662f\u5426\u5df2\u5b89\u88c5\u3002\u4f7f\u7528 systemctl start nginx \u542f\u52a8 nginx \u670d\u52a1\u3002\u4f7f\u7528 systemctl enable nginx \u542f\u7528\u5728\u7cfb\u7edf\u542f\u52a8\u65f6\u81ea\u52a8\u542f\u52a8 nginx\u3002\u4f7f\u7528 systemctl status nginx \u9a8c\u8bc1\u542f\u52a8\u662f\u5426\u6210\u529f\u3002\u5728 web \u6d4f\u89c8\u5668\u4e2d\u8bbf\u95ee http:\/\/localhost \u67e5\u770b\u9ed8\u8ba4\u6b22\u8fce\u9875\u9762\u3002 \u5982\u4f55\u5728 Linux \u4e2d\u542f\u52a8 Nginx \u8981\u5728 Linux \u4e2d\u542f\u52a8 Nginx\uff0c\u8bf7\u6267\u884c\u4ee5\u4e0b\u6b65\u9aa4\uff1a 1. \u68c0\u67e5 Nginx \u662f\u5426\u5df2\u5b89\u88c5 \u68c0\u67e5 Nginx \u662f\u5426\u5df2\u7ecf\u5b89\u88c5\u5728\u7cfb\u7edf\u4e0a\uff1a $ systemctl status nginx \u767b\u5f55\u540e\u590d\u5236 \u767b\u5f55\u540e\u590d\u5236 \u5982\u679c Nginx \u5df2\u5b89\u88c5\uff0c\u5b83\u5c06\u663e\u793a\u201cactive (running)\u201d\u3002 2. \u542f\u52a8 Nginx \u670d\u52a1 [&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-18004","post","type-post","status-publish","format-standard","hentry","category-os"],"_links":{"self":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/18004","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=18004"}],"version-history":[{"count":0,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/18004\/revisions"}],"wp:attachment":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/media?parent=18004"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/categories?post=18004"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/tags?post=18004"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}