{"id":54307,"date":"2024-10-09T18:20:18","date_gmt":"2024-10-09T10:20:18","guid":{"rendered":"https:\/\/server.hk\/cnblog\/54307\/"},"modified":"2024-10-09T18:20:18","modified_gmt":"2024-10-09T10:20:18","slug":"windows-%e4%b8%8b-nginx-http-%e4%bc%ba%e6%9c%8d%e5%99%a8%e5%85%a5%e9%96%80%e6%95%99%e7%a8%8b%e5%88%9d%e7%b4%9a%e7%af%87","status":"publish","type":"post","link":"https:\/\/server.hk\/cnblog\/54307\/","title":{"rendered":"Windows \u4e0b Nginx HTTP \u4f3a\u670d\u5668\u5165\u9580\u6559\u7a0b\u521d\u7d1a\u7bc7"},"content":{"rendered":"<h1 id=\"windows-%e4%b8%8b-nginx-http-%e4%bc%ba%e6%9c%8d%e5%99%a8%e5%85%a5%e9%96%80%e6%95%99%e7%a8%8b%e5%88%9d%e7%b4%9a%e7%af%87-EzPyVUDode\">Windows \u4e0b Nginx HTTP \u4f3a\u670d\u5668\u5165\u9580\u6559\u7a0b\u521d\u7d1a\u7bc7<\/h1>\n<p>Nginx \u662f\u4e00\u6b3e\u9ad8\u6548\u80fd\u7684 HTTP \u4f3a\u670d\u5668\uff0c\u5ee3\u6cdb\u61c9\u7528\u65bc\u7db2\u7ad9\u7684\u975c\u614b\u5167\u5bb9\u670d\u52d9\u3001\u53cd\u5411\u4ee3\u7406\u53ca\u8ca0\u8f09\u5747\u8861\u7b49\u5834\u666f\u3002\u672c\u6587\u5c07\u4ecb\u7d39\u5982\u4f55\u5728 Windows \u74b0\u5883\u4e0b\u5b89\u88dd\u548c\u914d\u7f6e Nginx\uff0c\u5e6b\u52a9\u521d\u5b78\u8005\u5feb\u901f\u4e0a\u624b\u3002<\/p>\n<h2 id=\"%e4%b8%80%e3%80%81%e4%b8%8b%e8%bc%89-nginx-EzPyVUDode\">\u4e00\u3001\u4e0b\u8f09 Nginx<\/h2>\n<p>\u9996\u5148\uff0c\u60a8\u9700\u8981\u5f9e Nginx \u7684\u5b98\u65b9\u7db2\u7ad9\u4e0b\u8f09\u6700\u65b0\u7248\u672c\u7684 Nginx\u3002\u8acb\u8a2a\u554f <a href=\"http:\/\/nginx.org\/en\/download.html\" rel=\"nofollow noopener\" target=\"_blank\">Nginx \u4e0b\u8f09\u9801\u9762<\/a>\uff0c\u9078\u64c7\u9069\u5408 Windows \u7684\u7248\u672c\u9032\u884c\u4e0b\u8f09\u3002<\/p>\n<h2 id=\"%e4%ba%8c%e3%80%81%e5%ae%89%e8%a3%9d-nginx-EzPyVUDode\">\u4e8c\u3001\u5b89\u88dd Nginx<\/h2>\n<p>\u4e0b\u8f09\u5b8c\u6210\u5f8c\uff0c\u89e3\u58d3\u7e2e\u4e0b\u8f09\u7684 ZIP \u6587\u4ef6\u5230\u60a8\u5e0c\u671b\u5b89\u88dd Nginx \u7684\u76ee\u9304\uff0c\u4f8b\u5982\uff1aC:nginx\u3002<\/p>\n<h2 id=\"%e4%b8%89%e3%80%81%e5%95%9f%e5%8b%95-nginx-EzPyVUDode\">\u4e09\u3001\u555f\u52d5 Nginx<\/h2>\n<p>\u8981\u555f\u52d5 Nginx\uff0c\u8acb\u6309\u7167\u4ee5\u4e0b\u6b65\u9a5f\u64cd\u4f5c\uff1a<\/p>\n<ol>\n<li>\u6253\u958b\u547d\u4ee4\u63d0\u793a\u7b26\uff08CMD\uff09\uff0c\u53ef\u4ee5\u901a\u904e\u5728\u958b\u59cb\u83dc\u55ae\u4e2d\u641c\u7d22\u201ccmd\u201d\u4f86\u627e\u5230\u3002<\/li>\n<li>\u4f7f\u7528 cd \u547d\u4ee4\u5207\u63db\u5230 Nginx \u7684\u5b89\u88dd\u76ee\u9304\uff0c\u4f8b\u5982\uff1a<\/li>\n<pre><code>cd C:nginx<\/code><\/pre>\n<li>\u8f38\u5165\u4ee5\u4e0b\u547d\u4ee4\u555f\u52d5 Nginx\uff1a<\/li>\n<pre><code>start nginx<\/code><\/pre>\n<\/ol>\n<p>\u5982\u679c\u4e00\u5207\u6b63\u5e38\uff0c\u60a8\u53ef\u4ee5\u5728\u700f\u89bd\u5668\u4e2d\u8f38\u5165 <code>http:\/\/localhost<\/code>\uff0c\u61c9\u8a72\u80fd\u770b\u5230 Nginx \u7684\u6b61\u8fce\u9801\u9762\u3002<\/p>\n<h2 id=\"%e5%9b%9b%e3%80%81%e9%85%8d%e7%bd%ae-nginx-EzPyVUDode\">\u56db\u3001\u914d\u7f6e Nginx<\/h2>\n<p>Nginx \u7684\u914d\u7f6e\u6587\u4ef6\u4f4d\u65bc\u5b89\u88dd\u76ee\u9304\u4e0b\u7684 <code>conf\/nginx.conf<\/code>\u3002\u60a8\u53ef\u4ee5\u4f7f\u7528\u4efb\u4f55\u6587\u672c\u7de8\u8f2f\u5668\uff08\u5982 Notepad++\uff09\u6253\u958b\u6b64\u6587\u4ef6\u9032\u884c\u7de8\u8f2f\u3002<\/p>\n<h3 id=\"1-%e5%9f%ba%e6%9c%ac%e9%85%8d%e7%bd%ae-EzPyVUDode\">1. \u57fa\u672c\u914d\u7f6e<\/h3>\n<p>\u4ee5\u4e0b\u662f\u4e00\u500b\u7c21\u55ae\u7684\u914d\u7f6e\u7bc4\u4f8b\uff1a<\/p>\n<pre><code>server {\n    listen       80;\n    server_name  localhost;\n\n    location \/ {\n        root   html;\n        index  index.html index.htm;\n    }\n\n    error_page   404  \/404.html;\n    location = \/404.html {\n        internal;\n    }\n}<\/code><\/pre>\n<p>\u9019\u6bb5\u914d\u7f6e\u544a\u8a34 Nginx \u76e3\u807d 80 \u7aef\u53e3\uff0c\u4e26\u5c07\u8acb\u6c42\u7684\u6839\u76ee\u9304\u8a2d\u7f6e\u70ba <code>html<\/code> \u6587\u4ef6\u593e\u3002<\/p>\n<h3 id=\"2-%e9%87%8d%e6%96%b0%e5%8a%a0%e8%bc%89%e9%85%8d%e7%bd%ae-EzPyVUDode\">2. \u91cd\u65b0\u52a0\u8f09\u914d\u7f6e<\/h3>\n<p>\u5728\u4fee\u6539\u5b8c\u914d\u7f6e\u6587\u4ef6\u5f8c\uff0c\u60a8\u9700\u8981\u91cd\u65b0\u52a0\u8f09 Nginx \u4ee5\u4f7f\u66f4\u6539\u751f\u6548\u3002\u53ef\u4ee5\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\uff1a<\/p>\n<pre><code>nginx -s reload<\/code><\/pre>\n<h2 id=\"%e4%ba%94%e3%80%81%e6%9f%a5%e7%9c%8b%e6%97%a5%e8%aa%8c-EzPyVUDode\">\u4e94\u3001\u67e5\u770b\u65e5\u8a8c<\/h2>\n<p>Nginx \u6703\u81ea\u52d5\u751f\u6210\u8a2a\u554f\u65e5\u8a8c\u548c\u932f\u8aa4\u65e5\u8a8c\uff0c\u9019\u4e9b\u65e5\u8a8c\u6587\u4ef6\u4f4d\u65bc <code>logs<\/code> \u76ee\u9304\u4e0b\u3002\u60a8\u53ef\u4ee5\u901a\u904e\u67e5\u770b\u9019\u4e9b\u65e5\u8a8c\u4f86\u4e86\u89e3\u4f3a\u670d\u5668\u7684\u904b\u884c\u72c0\u6cc1\u3002<\/p>\n<h2 id=\"%e5%85%ad%e3%80%81%e5%b8%b8%e8%a6%8b%e5%95%8f%e9%a1%8c-EzPyVUDode\">\u516d\u3001\u5e38\u898b\u554f\u984c<\/h2>\n<ul>\n<li><strong>\u5982\u4f55\u505c\u6b62 Nginx\uff1f<\/strong><br \/>\u53ef\u4ee5\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\u505c\u6b62 Nginx\uff1a<\/li>\n<pre><code>nginx -s stop<\/code><\/pre>\n<li><strong>\u5982\u4f55\u67e5\u770b Nginx \u7684\u7248\u672c\uff1f<\/strong><br \/>\u53ef\u4ee5\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\u67e5\u770b\u7248\u672c\uff1a<\/li>\n<pre><code>nginx -v<\/code><\/pre>\n<\/ul>\n<h2 id=\"%e7%b8%bd%e7%b5%90-EzPyVUDode\">\u7e3d\u7d50<\/h2>\n<p>\u672c\u6587\u4ecb\u7d39\u4e86\u5982\u4f55\u5728 Windows \u74b0\u5883\u4e0b\u5b89\u88dd\u548c\u914d\u7f6e Nginx HTTP \u4f3a\u670d\u5668\u3002\u901a\u904e\u7c21\u55ae\u7684\u6b65\u9a5f\uff0c\u60a8\u53ef\u4ee5\u5feb\u901f\u642d\u5efa\u4e00\u500b\u57fa\u672c\u7684\u4f3a\u670d\u5668\u74b0\u5883\u3002\u82e5\u60a8\u9700\u8981\u66f4\u9ad8\u6548\u7684\u4f3a\u670d\u5668\u89e3\u6c7a\u65b9\u6848\uff0c\u8003\u616e\u4f7f\u7528 <a href=\"https:\/\/server.hk\">\u9999\u6e2f VPS<\/a> \u670d\u52d9\uff0c\u9019\u5c07\u70ba\u60a8\u7684\u7db2\u7ad9\u63d0\u4f9b\u66f4\u7a69\u5b9a\u7684\u6027\u80fd\u548c\u66f4\u597d\u7684\u5b89\u5168\u6027\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u5b78\u7fd2\u5982\u4f55\u5728 Windows \u4e0a\u5b89\u88dd\u548c\u914d\u7f6e Nginx HTTP \u4f3a\u670d\u5668\uff0c\u9069\u5408\u521d\u5b78\u8005\u7684\u8a73\u7d30\u5165\u9580\u6559\u7a0b\uff0c\u5feb\u901f\u4e0a\u624b\u7db2\u7ad9\u642d\u5efa\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-54307","post","type-post","status-publish","format-standard","hentry","category-setup-tutorials"],"_links":{"self":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/54307","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=54307"}],"version-history":[{"count":1,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/54307\/revisions"}],"predecessor-version":[{"id":54308,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/54307\/revisions\/54308"}],"wp:attachment":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/media?parent=54307"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/categories?post=54307"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/tags?post=54307"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}