{"id":63514,"date":"2025-04-29T08:09:51","date_gmt":"2025-04-29T00:09:51","guid":{"rendered":"https:\/\/fwq.ai\/blog\/63514\/"},"modified":"2025-04-29T08:09:51","modified_gmt":"2025-04-29T00:09:51","slug":"nginx%e5%9c%a8windows%e4%b8%ad%e6%80%8e%e4%b9%88%e9%85%8d%e7%bd%ae-2","status":"publish","type":"post","link":"https:\/\/fwq.ai\/blog\/63514\/","title":{"rendered":"nginx\u5728windows\u4e2d\u600e\u4e48\u914d\u7f6e"},"content":{"rendered":"<blockquote><p>\n  \u5982\u4f55\u5728 windows \u4e2d\u914d\u7f6e nginx\uff1f\u5b89\u88c5 nginx \u5e76\u521b\u5efa\u865a\u62df\u4e3b\u673a\u914d\u7f6e\u3002\u4fee\u6539\u4e3b\u914d\u7f6e\u6587\u4ef6\u5e76\u5305\u542b\u865a\u62df\u4e3b\u673a\u914d\u7f6e\u3002\u542f\u52a8\u6216\u91cd\u65b0\u52a0\u8f7d nginx\u3002\u6d4b\u8bd5\u914d\u7f6e\u5e76\u67e5\u770b\u7f51\u7ad9\u3002\u9009\u62e9\u6027\u542f\u7528 ssl \u5e76\u914d\u7f6e ssl \u8bc1\u4e66\u3002\u9009\u62e9\u6027\u8bbe\u7f6e\u9632\u706b\u5899\u5141\u8bb8 80 \u548c 443 \u7aef\u53e3\u6d41\u91cf\u3002\n<\/p><\/blockquote>\n<p><img decoding=\"async\" src=\"https:\/\/img.php.cn\/upload\/article\/202405\/27\/2024052717122147322.jpg\" class=\"aligncenter\" title=\"nginx\u5728windows\u4e2d\u600e\u4e48\u914d\u7f6e\u63d2\u56fe\" alt=\"nginx\u5728windows\u4e2d\u600e\u4e48\u914d\u7f6e\u63d2\u56fe\" \/><\/p>\n<p><strong>\u5982\u4f55\u5728 Windows \u4e2d\u914d\u7f6e Nginx<\/strong><\/p>\n<p>Nginx \u662f\u4e00\u4e2a\u6d41\u884c\u7684 Web \u670d\u52a1\u5668\uff0c\u5b83\u53ef\u4ee5\u5728 Windows \u64cd\u4f5c\u7cfb\u7edf\u4e0a\u914d\u7f6e\u548c\u4f7f\u7528\u3002\u4ee5\u4e0b\u662f\u5982\u4f55\u5728 Windows \u4e2d\u5b89\u88c5\u548c\u914d\u7f6e Nginx\uff1a<\/p>\n<p><strong>1. \u5b89\u88c5 Nginx<\/strong><\/p>\n<ul>\n<li>\u4ece Nginx \u7684\u5b98\u65b9\u7f51\u7ad9\u4e0b\u8f7d\u6700\u65b0\u7684 Windows \u5b89\u88c5\u5305\u3002<\/li>\n<li>\u53cc\u51fb\u5b89\u88c5\u5305\u5e76\u6309\u7167\u63d0\u793a\u8fdb\u884c\u64cd\u4f5c\u3002<\/li>\n<li>\u5b8c\u6210\u5b89\u88c5\u540e\uff0cNginx \u670d\u52a1\u5c06\u81ea\u52a8\u542f\u52a8\u3002<\/li>\n<\/ul>\n<p><strong>2. \u914d\u7f6e Nginx<\/strong><\/p>\n<ul>\n<li> <strong>\u521b\u5efa\u865a\u62df\u4e3b\u673a\u914d\u7f6e\uff1a<\/strong>\u4f7f\u7528\u8bb0\u4e8b\u672c\u6216\u5176\u4ed6\u6587\u672c\u7f16\u8f91\u5668\u521b\u5efa\u5982\u4e0b\u6587\u4ef6\uff1a<\/li>\n<\/ul>\n<pre>C:\nginxconfhost.conf<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<ul>\n<li>\u5c06\u4ee5\u4e0b\u5185\u5bb9\u6dfb\u52a0\u5230\u6587\u4ef6\u4e2d\uff1a<\/li>\n<\/ul>\n<pre>server {\n    listen 80;\n    server_name example.com;\n    root C:\/path\/to\/your\/website;\n    index index.html index.php;\n}<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<ul>\n<li>\u66ff\u6362 example.com \u4e3a\u60a8\u7684\u57df\u540d\uff0c\u5e76\u5c06 C:\/path\/to\/your\/website \u66ff\u6362\u4e3a\u7f51\u7ad9\u6587\u4ef6\u7684\u5b9e\u9645\u8def\u5f84\u3002<\/li>\n<li> <strong>\u4fee\u6539 Nginx \u4e3b\u914d\u7f6e\u6587\u4ef6\uff1a<\/strong>\u6253\u5f00\u4ee5\u4e0b\u6587\u4ef6\uff1a<\/li>\n<\/ul>\n<pre>C:\nginxconf\nginx.conf<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<ul>\n<li>\u6dfb\u52a0\u4ee5\u4e0b\u5185\u5bb9\uff1a<\/li>\n<\/ul>\n<pre>include vhost.conf;<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<ul>\n<li>\u4fdd\u5b58\u66f4\u6539\u3002<\/li>\n<\/ul>\n<p><strong>3. \u542f\u52a8\u6216\u91cd\u65b0\u52a0\u8f7d Nginx<\/strong><\/p>\n<ul>\n<li>\u5982\u679c Nginx \u6b63\u5728\u8fd0\u884c\uff0c\u8bf7\u91cd\u65b0\u52a0\u8f7d\u914d\u7f6e\uff1a<\/li>\n<\/ul>\n<pre>net stop nginx\nnet start nginx<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<ul>\n<li>\u5982\u679c Nginx \u6ca1\u6709\u8fd0\u884c\uff0c\u8bf7\u542f\u52a8\u5b83\uff1a<\/li>\n<\/ul>\n<pre>net start nginx<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p><strong>4. \u6d4b\u8bd5\u914d\u7f6e<\/strong><\/p>\n<ul>\n<li>\u5728\u6d4f\u89c8\u5668\u4e2d\u8bbf\u95ee\u60a8\u7684\u57df\u540d\u3002\u5982\u679c\u60a8\u770b\u5230\u7f51\u7ad9\uff0c\u5219\u8868\u793a Nginx \u914d\u7f6e\u6210\u529f\u3002<\/li>\n<\/ul>\n<p><strong>5. \u542f\u7528 SSL\uff08\u53ef\u9009\uff09<\/strong><\/p>\n<ul>\n<li>\u83b7\u53d6 SSL \u8bc1\u4e66\u3002<\/li>\n<li>\u5c06\u8bc1\u4e66\u6587\u4ef6\u590d\u5236\u5230 Nginx \u7684 conf \u76ee\u5f55\u4e2d\u3002<\/li>\n<li>\u5728\u60a8\u7684\u865a\u62df\u4e3b\u673a\u914d\u7f6e\u4e2d\u914d\u7f6e SSL\uff1a<\/li>\n<\/ul>\n<pre>server {\n    listen 443 ssl;\n    server_name example.com;\n    root C:\/path\/to\/your\/website;\n    index index.html index.php;\n\n    ssl_certificate ssl.crt;\n    ssl_certificate_key ssl.key;\n}<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<ul>\n<li>\u91cd\u65b0\u52a0\u8f7d Nginx \u914d\u7f6e\u3002<\/li>\n<\/ul>\n<p><strong>6. \u8bbe\u7f6e\u9632\u706b\u5899\uff08\u53ef\u9009\uff09<\/strong><\/p>\n<ul>\n<li>\u5141\u8bb8 Nginx 80 \u548c 443 \u7aef\u53e3\u7684\u5165\u7ad9\u6d41\u91cf\u3002<\/li>\n<\/ul>\n<p>\u60a8\u73b0\u5728\u5df2\u5728 Windows \u4e2d\u6210\u529f\u914d\u7f6e Nginx\u3002<\/p>\n<p>\u4ee5\u4e0a\u5c31\u662f\u5728windows\u4e2d\u600e\u4e48\u914d\u7f6e\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>\u5982\u4f55\u5728 windows \u4e2d\u914d\u7f6e nginx\uff1f\u5b89\u88c5 nginx \u5e76\u521b\u5efa\u865a\u62df\u4e3b\u673a\u914d\u7f6e\u3002\u4fee\u6539\u4e3b\u914d\u7f6e\u6587\u4ef6\u5e76\u5305\u542b\u865a\u62df\u4e3b\u673a\u914d\u7f6e\u3002\u542f\u52a8\u6216\u91cd\u65b0\u52a0\u8f7d nginx\u3002\u6d4b\u8bd5\u914d\u7f6e\u5e76\u67e5\u770b\u7f51\u7ad9\u3002\u9009\u62e9\u6027\u542f\u7528 ssl \u5e76\u914d\u7f6e ssl \u8bc1\u4e66\u3002\u9009\u62e9\u6027\u8bbe\u7f6e\u9632\u706b\u5899\u5141\u8bb8 80 \u548c 443 \u7aef\u53e3\u6d41\u91cf\u3002 \u5982\u4f55\u5728 Windows \u4e2d\u914d\u7f6e Nginx Nginx \u662f\u4e00\u4e2a\u6d41\u884c\u7684 Web \u670d\u52a1\u5668\uff0c\u5b83\u53ef\u4ee5\u5728 Windows \u64cd\u4f5c\u7cfb\u7edf\u4e0a\u914d\u7f6e\u548c\u4f7f\u7528\u3002\u4ee5\u4e0b\u662f\u5982\u4f55\u5728 Windows \u4e2d\u5b89\u88c5\u548c\u914d\u7f6e Nginx\uff1a 1. \u5b89\u88c5 Nginx \u4ece Nginx \u7684\u5b98\u65b9\u7f51\u7ad9\u4e0b\u8f7d\u6700\u65b0\u7684 Windows \u5b89\u88c5\u5305\u3002 \u53cc\u51fb\u5b89\u88c5\u5305\u5e76\u6309\u7167\u63d0\u793a\u8fdb\u884c\u64cd\u4f5c\u3002 \u5b8c\u6210\u5b89\u88c5\u540e\uff0cNginx \u670d\u52a1\u5c06\u81ea\u52a8\u542f\u52a8\u3002 2. \u914d\u7f6e Nginx \u521b\u5efa\u865a\u62df\u4e3b\u673a\u914d\u7f6e\uff1a\u4f7f\u7528\u8bb0\u4e8b\u672c\u6216\u5176\u4ed6\u6587\u672c\u7f16\u8f91\u5668\u521b\u5efa\u5982\u4e0b\u6587\u4ef6\uff1a C: ginxconfhost.conf \u767b\u5f55\u540e\u590d\u5236 \u5c06\u4ee5\u4e0b\u5185\u5bb9\u6dfb\u52a0\u5230\u6587\u4ef6\u4e2d\uff1a server { listen 80; server_name example.com; root C:\/path\/to\/your\/website; [&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-63514","post","type-post","status-publish","format-standard","hentry","category-os"],"_links":{"self":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/63514","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=63514"}],"version-history":[{"count":0,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/63514\/revisions"}],"wp:attachment":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/media?parent=63514"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/categories?post=63514"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/tags?post=63514"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}