{"id":23886,"date":"2025-04-19T08:42:25","date_gmt":"2025-04-19T00:42:25","guid":{"rendered":"https:\/\/www.wsisp.com\/helps\/23886.html"},"modified":"2025-04-19T08:42:25","modified_gmt":"2025-04-19T00:42:25","slug":"%e4%b8%80%e4%b8%aa%e6%af%94-nginx-%e8%bf%98%e7%ae%80%e5%8d%95%e7%9a%84-web-%e6%9c%8d%e5%8a%a1%e5%99%a8","status":"publish","type":"post","link":"https:\/\/www.wsisp.com\/helps\/23886.html","title":{"rendered":"\u4e00\u4e2a\u6bd4 Nginx \u8fd8\u7b80\u5355\u7684 Web \u670d\u52a1\u5668"},"content":{"rendered":"<p>\u4f01\u4e1a\u7ea7\u7684 Web \u670d\u52a1\u5668\u975e\u5e38\u591a&#xff0c;Nginx\u3001Tomcat\u3001Apache\u3001IIS\u3001FastAPI\u3001Flask \u7b49\u3002\u4eca\u5929\u677e\u54e5\u518d\u7ed9\u5927\u5bb6\u4ecb\u7ecd\u4e00\u4e2a\u5f00\u6e90\u7684 Web \u670d\u52a1\u5668&#xff0c;\u8fd9\u6b3e\u670d\u52a1\u5668\u5177\u5907\u81ea\u52a8 HTTPS \u529f\u80fd\u548c\u9ad8\u5ea6\u53ef\u914d\u7f6e\u6027&#xff0c;\u5b83\u7684\u540d\u5b57\u662f&#xff1a;Caddy\u3002<\/p>\n<p>Caddy \u662f\u4e00\u4e2a Go \u7f16\u5199\u7684 Web \u670d\u52a1\u5668&#xff0c;\u7c7b\u4f3c\u4e8e Nginx&#xff0c;Caddy \u63d0\u4f9b\u4e86\u66f4\u52a0\u5f3a\u5927\u7684\u529f\u80fd&#xff0c;\u968f\u7740 v2 \u7248\u672c\u53d1\u5e03&#xff0c;Caddy \u5df2\u7ecf\u53ef\u4ee5\u4f5c\u4e3a\u4e2d\u5c0f\u578b\u7ad9\u70b9 Web \u670d\u52a1\u5668\u7684\u53e6\u4e00\u4e2a\u9009\u62e9\u3002<\/p>\n<p>\u76f8\u8f83\u4e8e Nginx \u6765\u8bf4\u4f7f\u7528 Caddy \u7684\u4f18\u52bf\u5982\u4e0b:<\/p>\n<li>\u81ea\u52a8HTTPS&#xff1a;Caddy \u7684\u81ea\u52a8 TLS \u529f\u80fd&#xff0c;\u8ba9 HTTPS \u53d8\u5f97\u89e6\u624b\u53ef\u53ca&#xff0c;\u65e0\u9700\u989d\u5916\u914d\u7f6e\u3002<\/li>\n<li>\u914d\u7f6e\u7b80\u4fbf\u6027&#xff1a;Caddy \u63d0\u4f9b\u4e86\u4e24\u79cd\u914d\u7f6e\u65b9\u5f0f\u2014\u2014\u7b80\u6d01\u7684 Caddyfile \u548c\u529f\u80fd\u4e30\u5bcc\u7684 JSON \u683c\u5f0f\u3002<\/li>\n<li>\u914d\u7f6e\u7075\u6d3b\u6027&#xff1a;\u901a\u8fc7 JSON API&#xff0c;Caddy \u5141\u8bb8\u5b9e\u65f6\u66f4\u65b0\u914d\u7f6e&#xff0c;\u63d0\u4f9b\u4e86\u6781\u5927\u7684\u7075\u6d3b\u6027\u3002<\/li>\n<li>\u4ee3\u7406\u80fd\u529b&#xff1a;Caddy \u7684 HTTP \u53cd\u5411\u4ee3\u7406\u529f\u80fd\u5f3a\u5927\u800c\u7075\u6d3b\u3002<\/li>\n<li>\u9759\u6001\u8d44\u6e90\u6258\u7ba1&#xff1a;\u4f5c\u4e3a\u9759\u6001\u6587\u4ef6\u670d\u52a1\u5668&#xff0c;Caddy \u5df2\u7ecf\u8bc1\u660e\u4e86\u5176\u5728\u751f\u4ea7\u73af\u5883\u4e2d\u7684\u53ef\u9760\u6027\u548c\u6269\u5c55\u6027\u3002<\/li>\n<li>\u5168\u5e73\u53f0\u652f\u6301&#xff1a;Caddy \u652f\u6301 Linux\u3001Windows\u3001macOS \u7b49\u591a\u79cd\u64cd\u4f5c\u7cfb\u7edf\u3002<\/li>\n<li>\u9ad8\u6027\u80fd&#xff1a;Go \u8bed\u8a00\u7684\u5f00\u53d1\u80cc\u666f&#xff0c;\u4fdd\u8bc1\u4e86 Caddy \u7684\u9ad8\u6548\u6027\u80fd\u548c\u5185\u5b58\u5b89\u5168\u3002<\/li>\n<p>Caddy \u8f7b\u91cf\u7b80\u5355&#xff0c;\u5bf9\u65b0\u624b\u4e5f\u6bd4\u8f83\u53cb\u597d&#xff0c;\u6211\u4eec\u4e00\u8d77\u6765\u770b\u4e0b Caddy \u7684\u7528\u6cd5\u5427\u3002<\/p>\n<h4>\u4e00 \u5b89\u88c5<\/h4>\n<p>\u53ef\u4ee5\u76f4\u63a5\u4f7f\u7528 Linux \u91cc\u8fb9\u7684\u5305\u7ba1\u7406\u5de5\u5177\u6765\u5b89\u88c5 Caddy\u3002<\/p>\n<p>\u4f8b\u5982&#xff0c;\u5728 Ubuntu \u4e2d\u6211\u4eec\u53ef\u4ee5\u4f7f\u7528\u5982\u4e0b\u547d\u4ee4\u5b89\u88c5&#xff1a;<\/p>\n<p>sudo apt install -y debian-keyring debian-archive-keyring apt-transport-https<br \/>\ncurl -1sLf &#039;https:\/\/dl.cloudsmith.io\/public\/caddy\/stable\/gpg.key&#039; | sudo gpg &#8211;dearmor -o \/usr\/share\/keyrings\/caddy-stable-archive-keyring.gpg<br \/>\ncurl -1sLf &#039;https:\/\/dl.cloudsmith.io\/public\/caddy\/stable\/debian.deb.txt&#039; | sudo tee \/etc\/apt\/sources.list.d\/caddy-stable.list<br \/>\nsudo apt update<br \/>\nsudo apt install caddy<\/p>\n<p>\u5982\u679c\u662f Redhat \u6216\u8005\u662f CentOS \u7684\u8bdd&#xff0c;\u5219\u53ef\u4ee5\u4f7f\u7528\u5982\u4e0b\u547d\u4ee4\u5b89\u88c5&#xff1a;<\/p>\n<p>yum install yum-plugin-copr<br \/>\nyum copr enable &#064;caddy\/caddy<br \/>\nyum install caddy<\/p>\n<p>\u5f53\u7136&#xff0c;\u8fd9\u73a9\u610f\u4e5f\u63d0\u4f9b\u4e86 Docker \u955c\u50cf&#xff0c;\u4e5f\u53ef\u4ee5\u4f7f\u7528 Docker \u5b89\u88c5\u3002<\/p>\n<h4>\u4e8c \u914d\u7f6e<\/h4>\n<p>Caddy \u7684\u914d\u7f6e\u6587\u4ef6\u53ef\u4ee5\u662f JSON \u683c\u5f0f\u6216 Caddyfile \u683c\u5f0f\u3002<\/p>\n<p>Caddyfile \u662f\u4e00\u79cd\u66f4\u52a0\u7b80\u6d01\u7684\u6587\u672c\u914d\u7f6e\u683c\u5f0f&#xff0c;\u9002\u5408\u5feb\u901f\u914d\u7f6e\u5e38\u89c1\u7684\u7528\u4f8b\u3002<\/p>\n<p>\u4e0b\u9762\u6211\u5c06\u91cd\u70b9\u4ecb\u7ecd Caddyfile \u7684\u914d\u7f6e\u65b9\u5f0f\u3002<\/p>\n<h5>2.1 Caddyfile \u57fa\u7840\u8bed\u6cd5<\/h5>\n<p>Caddyfile \u4f7f\u7528\u7b80\u5355\u7684\u6587\u672c\u683c\u5f0f&#xff0c;\u6bcf\u4e00\u884c\u53ef\u4ee5\u5305\u542b\u4e00\u4e2a\u670d\u52a1\u5668\u5757&#xff0c;\u5176\u4e2d\u5305\u542b\u57df\u540d\u3001TLS \u8bbe\u7f6e\u548c\u5176\u4ed6\u6307\u4ee4\u3002\u670d\u52a1\u5668\u5757\u4ee5\u57df\u540d\u5f00\u59cb&#xff0c;\u540e\u9762\u8ddf\u7740\u4e00\u7cfb\u5217\u7684\u6307\u4ee4\u3002<\/p>\n<h6>\u670d\u52a1\u5668\u5757<\/h6>\n<p>\u4e00\u4e2a\u5178\u578b\u7684 Caddyfile \u670d\u52a1\u5668\u5757\u5982\u4e0b\u6240\u793a&#xff1a;<\/p>\n<p>javaboy.org {<br \/>\n    # \u914d\u7f6e\u6307\u4ee4<br \/>\n}<\/p>\n<h6>\u5e38\u89c1\u6307\u4ee4<\/h6>\n<p>\u8fd9\u91cc\u6709\u4e00\u4e9b\u5e38\u7528\u7684\u6307\u4ee4&#xff1a;<\/p>\n<ul>\n<li>root: \u6307\u5b9a\u7f51\u7ad9\u7684\u6839\u76ee\u5f55\u3002<\/li>\n<li>tls: \u7528\u4e8e\u81ea\u52a8\u83b7\u53d6\u548c\u7ba1\u7406 TLS\/SSL \u8bc1\u4e66\u3002<\/li>\n<li>proxy: \u7528\u4e8e\u914d\u7f6e\u53cd\u5411\u4ee3\u7406\u3002<\/li>\n<li>rewrite: \u7528\u4e8e\u91cd\u5199 URL\u3002<\/li>\n<li>gzip: \u5f00\u542f GZIP \u538b\u7f29\u3002<\/li>\n<li>auth: \u914d\u7f6e\u57fa\u672c\u7684\u8eab\u4efd\u9a8c\u8bc1\u3002<\/li>\n<li>cache: \u914d\u7f6e\u7f13\u5b58\u8bbe\u7f6e\u3002<\/li>\n<li>log: \u914d\u7f6e\u65e5\u5fd7\u8f93\u51fa\u3002<\/li>\n<\/ul>\n<h5>2.2 \u793a\u4f8b\u914d\u7f6e<\/h5>\n<p>\u4e0b\u9762\u662f\u4e00\u4e2a\u7b80\u5355\u7684 Caddyfile \u793a\u4f8b&#xff0c;\u8be5\u793a\u4f8b\u914d\u7f6e\u4e86\u4e00\u4e2a\u7f51\u7ad9&#xff0c;\u5e76\u81ea\u52a8\u4e3a\u8be5\u7f51\u7ad9\u542f\u7528 HTTPS&#xff1a;<\/p>\n<p>javaboy.org {<br \/>\n    root \/var\/www\/html<br \/>\n    tls admin&#064;javaboy.org<\/p>\n<p>    gzip<br \/>\n    log \/var\/log\/caddy\/access.log combined<\/p>\n<p>    # \u53cd\u5411\u4ee3\u7406\u5230\u540e\u7aef\u670d\u52a1<br \/>\n    proxy \/ localhost:8080 {<br \/>\n        websocket<br \/>\n        transparent<br \/>\n    }<\/p>\n<p>    # \u57fa\u672c\u8eab\u4efd\u9a8c\u8bc1<br \/>\n    auth \/admin user:password<br \/>\n}<\/p>\n<h6>\u89e3\u91ca<\/h6>\n<ul>\n<li>javaboy.org: \u57df\u540d&#xff0c;\u53ef\u4ee5\u662f\u591a\u4e2a\u57df\u540d&#xff0c;\u7528\u7a7a\u683c\u9694\u5f00\u3002<\/li>\n<li>root \/var\/www\/html: \u6307\u5b9a\u7f51\u7ad9\u5185\u5bb9\u6240\u5728\u7684\u76ee\u5f55\u3002<\/li>\n<li>tls admin&#064;example.com: \u4e3a\u57df\u540d\u81ea\u52a8\u914d\u7f6e TLS \u8bc1\u4e66&#xff0c;\u5e76\u6307\u5b9a\u7528\u4e8e\u63a5\u6536\u8bc1\u4e66\u901a\u77e5\u7684\u7535\u5b50\u90ae\u4ef6\u5730\u5740\u3002<\/li>\n<li>gzip: \u542f\u7528 GZIP \u538b\u7f29\u3002<\/li>\n<li>log \/var\/log\/caddy\/access.log combined: \u5c06\u8bbf\u95ee\u65e5\u5fd7\u8bb0\u5f55\u5230\u6307\u5b9a\u7684\u6587\u4ef6\u4e2d\u3002<\/li>\n<li>proxy \/ localhost:8080: \u5c06\u6240\u6709\u8bf7\u6c42\u4ee3\u7406\u5230\u672c\u5730\u7684 8080 \u7aef\u53e3\u3002websocket \u548c transparent \u5206\u522b\u8868\u793a\u652f\u6301 WebSocket \u534f\u8bae\u548c\u900f\u660e\u4ee3\u7406\u3002<\/li>\n<li>auth \/admin user:password: \u5bf9 \/admin \u8def\u5f84\u4e0b\u7684\u8d44\u6e90\u542f\u7528\u57fa\u672c\u7684\u8eab\u4efd\u9a8c\u8bc1\u3002<\/li>\n<\/ul>\n<h5>2.3 \u9ad8\u7ea7\u914d\u7f6e<\/h5>\n<p>Caddy \u8fd8\u652f\u6301\u66f4\u590d\u6742\u7684\u914d\u7f6e&#xff0c;\u4f8b\u5982\u4f7f\u7528\u5b50\u5757\u6765\u8fdb\u4e00\u6b65\u7ec6\u5316\u914d\u7f6e\u3002\u4f8b\u5982&#xff0c;\u53ef\u4ee5\u4f7f\u7528 route \u5b50\u5757\u6765\u6839\u636e\u8bf7\u6c42\u8def\u5f84\u6267\u884c\u4e0d\u540c\u7684\u64cd\u4f5c&#xff1a;<\/p>\n<p>javaboy.org {<br \/>\n    root \/var\/www\/html<br \/>\n    tls admin&#064;javaboy.org<\/p>\n<p>    # \u6839\u636e\u8def\u5f84\u8def\u7531\u8bf7\u6c42<br \/>\n    route {<br \/>\n        \/static\/* {<br \/>\n            gzip<br \/>\n            fileserver \/var\/www\/static<br \/>\n        }<\/p>\n<p>        \/api\/* {<br \/>\n            proxy \/ localhost:8000<br \/>\n        }<\/p>\n<p>        \/* {<br \/>\n            index index.html<br \/>\n        }<br \/>\n    }<br \/>\n}<\/p>\n<p>\u5728\u8fd9\u4e2a\u4f8b\u5b50\u4e2d&#xff0c;\/static\/* \u8def\u5f84\u4e0b\u7684\u8bf7\u6c42\u88ab\u76f4\u63a5\u53d1\u9001\u5230 \/var\/www\/static \u6587\u4ef6\u5939&#xff0c;\u800c \/api\/* \u8def\u5f84\u4e0b\u7684\u8bf7\u6c42\u88ab\u4ee3\u7406\u5230\u672c\u5730\u7684 8000 \u7aef\u53e3\u3002<\/p>\n<h5>2.4 \u591a\u4e2a\u670d\u52a1\u5668\u914d\u7f6e<\/h5>\n<p>Caddyfile \u652f\u6301\u5728\u540c\u4e00\u6587\u4ef6\u4e2d\u914d\u7f6e\u591a\u4e2a\u670d\u52a1\u5668&#xff1a;<\/p>\n<p>javaboy.org {<br \/>\n    # javaboy.org \u7684\u914d\u7f6e<br \/>\n}<\/p>\n<p>sub.javaboy.org {<br \/>\n    # sub.javaboy.org \u7684\u914d\u7f6e<br \/>\n}<\/p>\n<h5>2.5 \u52a8\u6001\u914d\u7f6e<\/h5>\n<p>\u9664\u4e86\u9759\u6001\u914d\u7f6e\u6587\u4ef6\u4e4b\u5916&#xff0c;Caddy \u8fd8\u652f\u6301\u52a8\u6001\u914d\u7f6e&#xff0c;\u53ef\u4ee5\u901a\u8fc7 HTTP API \u6765\u66f4\u6539\u914d\u7f6e\u3002\u8fd9\u4f7f\u5f97\u4f60\u53ef\u4ee5\u6839\u636e\u8fd0\u884c\u65f6\u6761\u4ef6\u52a8\u6001\u8c03\u6574\u670d\u52a1\u5668\u884c\u4e3a\u3002<\/p>\n<h4>\u4e09 \u6700\u4f73\u5b9e\u8df5<\/h4>\n<h5>3.1 \u90e8\u7f72\u9759\u6001\u7f51\u9875<\/h5>\n<p>http:\/\/yousite.com {<br \/>\nencode gzip # gzip\u538b\u7f29<br \/>\nroot * \/var\/web\/wwwroot # web\u6839\u76ee\u5f55<br \/>\nfile_server browse  # \u542f\u52a8\u9759\u6001\u8d44\u6e90<br \/>\n}<\/p>\n<p>\u6ce8\u610f&#xff0c;\u5982\u679c\u914d\u7f6e\u6839\u76ee\u5f55\u4e0b\u6709 index.html \u6587\u4ef6&#xff0c;\u5219\u4f1a\u81ea\u52a8\u90e8\u7f72\u4e3a\u9759\u6001\u7f51\u9875&#xff0c;\u5982\u679c\u6ca1\u6709\u5219\u4e3a\u7531 Caddy \u63d0\u4f9b\u7684\u6587\u4ef6\u5171\u4eab\u7684\u6d4f\u89c8\u7f51\u9875\u3002<\/p>\n<h5>3.2 \u90e8\u7f72 File_server<\/h5>\n<p>yousite.com {<br \/>\n   root * \/var\/share #\u6839\u76ee\u5f55<br \/>\n   file_server browse #\u542f\u52a8web\u6587\u4ef6\u670d\u52a1<br \/>\n}<\/p>\n<h5>3.3 \u53cd\u5411\u4ee3\u7406<\/h5>\n<p> yousite.com {<br \/>\n      reverse_proxy localhost:8082 #\u53cd\u5411\u4ee3\u7406<br \/>\n }<\/p>\n<h5>3.4 \u5176\u4ed6<\/h5>\n<p>caddy adapt  ## \u52a0\u8f7d\u914d\u7f6e\u6587\u4ef6<\/p>\n<p>caddy fmt ## \u683c\u5f0f\u5316\u914d\u7f6e<\/p>\n<p>caddy start  ## \u542f\u52a8\u670d\u52a1<\/p>\n<p>caddy reload ## \u91cd\u65b0\u90e8\u7f72<\/p>\n<h4>\u56db \u5c0f\u7ed3<\/h4>\n<p>Caddy \u5185\u7f6e\u4e86\u4e30\u5bcc\u7684\u63d2\u4ef6&#xff0c;\u4f8b\u5982\u5185\u7f6e \u201cfile_server\u201d\u3001\u5185\u7f6e\u5404\u79cd\u8d1f\u8f7d\u5747\u8861\u7b56\u7565\u7b49&#xff0c;\u8fd9\u4e9b\u63d2\u4ef6\u7ec4\u5408\u5728\u4e00\u8d77\u53ef\u4ee5\u5b9e\u73b0\u4e00\u4e9b\u590d\u6742\u7684\u529f\u80fd&#xff1b;Caddy \u662f\u91c7\u7528 go \u7f16\u5199\u7684&#xff0c;\u5b98\u65b9\u4e5f\u7ed9\u51fa\u4e86\u8be6\u7ec6\u7684\u5f00\u53d1\u6587\u6863&#xff0c;\u76f8\u8f83\u4e8e Nginx \u6765\u8bf4&#xff0c;Caddy \u7684\u63d2\u4ef6\u5f00\u53d1\u4e0a\u624b\u8981\u5bb9\u6613\u5f97\u591a&#xff1b;Caddy \u672c\u8eab\u9488\u5bf9\u6570\u636e\u5b58\u50a8\u3001\u52a8\u6001\u540e\u7aef\u3001\u914d\u7f6e\u6587\u4ef6\u8f6c\u6362\u7b49\u90fd\u5185\u7f6e\u4e86\u6269\u5c55\u63a5\u53e3&#xff0c;\u8fd9\u4e3a\u6709\u7279\u5b9a\u9700\u6c42\u7684\u6269\u5c55\u5f00\u53d1\u6253\u4e0b\u4e86\u826f\u597d\u57fa\u7840\u3002<\/p>\n<p>\u7efc\u5408\u6765\u770b\u76ee\u524d Caddy2 \u7684\u6027\u80fd\u635f\u5931\u53ef\u63a5\u53d7\u7684\u60c5\u51b5\u4e0b&#xff0c;\u76f8\u8f83\u4e8e Nginx \u7edd\u5bf9\u662f\u4e2a\u7edd\u4f73\u9009\u62e9&#xff0c;\u5404\u79cd\u65b0\u529f\u80fd\u90fd\u80fd\u591f\u6ee1\u8db3\u73b0\u4ee3\u5316 Web \u7ad9\u70b9\u7684\u9700\u6c42&#xff0c;\u771f\u9999\u8b66\u544a\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u6587\u7ae0\u6d4f\u89c8\u9605\u8bfb1.5k\u6b21\uff0c\u70b9\u8d5e18\u6b21\uff0c\u6536\u85cf11\u6b21\u3002\u4f01\u4e1a\u7ea7\u7684 Web \u670d\u52a1\u5668\u975e\u5e38\u591a\uff0cNginx\u3001Tomcat\u3001Apache\u3001IIS\u3001FastAPI\u3001Flask \u7b49\u3002\u4eca\u5929\u677e\u54e5\u518d\u7ed9\u5927\u5bb6\u4ecb\u7ecd\u4e00\u4e2a\u5f00\u6e90\u7684 Web \u670d\u52a1\u5668\uff0c\u8fd9\u6b3e\u670d\u52a1\u5668\u5177\u5907\u81ea\u52a8 HTTPS \u529f\u80fd\u548c\u9ad8\u5ea6\u53ef\u914d\u7f6e\u6027\uff0c\u5b83\u7684\u540d\u5b57\u662f\uff1aCaddy\u3002Caddy \u662f\u4e00\u4e2a Go \u7f16\u5199\u7684 Web \u670d\u52a1\u5668\uff0c\u7c7b\u4f3c\u4e8e Nginx\uff0cCaddy \u63d0\u4f9b\u4e86\u66f4\u52a0\u5f3a\u5927\u7684\u529f\u80fd\uff0c\u968f\u7740 v2 \u7248\u672c\u53d1\u5e03\uff0cCaddy \u5df2\u7ecf\u53ef\u4ee5\u4f5c\u4e3a\u4e2d\u5c0f\u578b\u7ad9\u70b9 Web \u670d\u52a1\u5668\u7684\u53e6\u4e00\u4e2a\u9009\u62e9\u3002Caddy \u8f7b\u91cf\u7b80\u5355\uff0c\u5bf9\u65b0\u624b\u4e5f\u6bd4\u8f83\u53cb\u597d\uff0c\u6211\u4eec\u4e00\u8d77\u6765\u770b\u4e0b Caddy \u7684\u7528\u6cd5\u5427\u3002_caddy\u670d\u52a1\u5668<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[117,87,177,43,178,176],"topic":[],"class_list":["post-23886","post","type-post","status-publish","format-standard","hentry","category-server","tag-nginx","tag-87","tag-177","tag-43","tag-178","tag-176"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v20.3 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>\u4e00\u4e2a\u6bd4 Nginx \u8fd8\u7b80\u5355\u7684 Web \u670d\u52a1\u5668 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.wsisp.com\/helps\/23886.html\" \/>\n<meta property=\"og:locale\" content=\"zh_CN\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"\u4e00\u4e2a\u6bd4 Nginx \u8fd8\u7b80\u5355\u7684 Web \u670d\u52a1\u5668 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"og:description\" content=\"\u6587\u7ae0\u6d4f\u89c8\u9605\u8bfb1.5k\u6b21\uff0c\u70b9\u8d5e18\u6b21\uff0c\u6536\u85cf11\u6b21\u3002\u4f01\u4e1a\u7ea7\u7684 Web \u670d\u52a1\u5668\u975e\u5e38\u591a\uff0cNginx\u3001Tomcat\u3001Apache\u3001IIS\u3001FastAPI\u3001Flask \u7b49\u3002\u4eca\u5929\u677e\u54e5\u518d\u7ed9\u5927\u5bb6\u4ecb\u7ecd\u4e00\u4e2a\u5f00\u6e90\u7684 Web \u670d\u52a1\u5668\uff0c\u8fd9\u6b3e\u670d\u52a1\u5668\u5177\u5907\u81ea\u52a8 HTTPS \u529f\u80fd\u548c\u9ad8\u5ea6\u53ef\u914d\u7f6e\u6027\uff0c\u5b83\u7684\u540d\u5b57\u662f\uff1aCaddy\u3002Caddy \u662f\u4e00\u4e2a Go \u7f16\u5199\u7684 Web \u670d\u52a1\u5668\uff0c\u7c7b\u4f3c\u4e8e Nginx\uff0cCaddy \u63d0\u4f9b\u4e86\u66f4\u52a0\u5f3a\u5927\u7684\u529f\u80fd\uff0c\u968f\u7740 v2 \u7248\u672c\u53d1\u5e03\uff0cCaddy \u5df2\u7ecf\u53ef\u4ee5\u4f5c\u4e3a\u4e2d\u5c0f\u578b\u7ad9\u70b9 Web \u670d\u52a1\u5668\u7684\u53e6\u4e00\u4e2a\u9009\u62e9\u3002Caddy \u8f7b\u91cf\u7b80\u5355\uff0c\u5bf9\u65b0\u624b\u4e5f\u6bd4\u8f83\u53cb\u597d\uff0c\u6211\u4eec\u4e00\u8d77\u6765\u770b\u4e0b Caddy \u7684\u7528\u6cd5\u5427\u3002_caddy\u670d\u52a1\u5668\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.wsisp.com\/helps\/23886.html\" \/>\n<meta property=\"og:site_name\" content=\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"article:published_time\" content=\"2025-04-19T00:42:25+00:00\" \/>\n<meta name=\"author\" content=\"admin\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"\u4f5c\u8005\" \/>\n\t<meta name=\"twitter:data1\" content=\"admin\" \/>\n\t<meta name=\"twitter:label2\" content=\"\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4\" \/>\n\t<meta name=\"twitter:data2\" content=\"2 \u5206\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/23886.html\",\"url\":\"https:\/\/www.wsisp.com\/helps\/23886.html\",\"name\":\"\u4e00\u4e2a\u6bd4 Nginx \u8fd8\u7b80\u5355\u7684 Web \u670d\u52a1\u5668 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"isPartOf\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\"},\"datePublished\":\"2025-04-19T00:42:25+00:00\",\"dateModified\":\"2025-04-19T00:42:25+00:00\",\"author\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\"},\"breadcrumb\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/23886.html#breadcrumb\"},\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.wsisp.com\/helps\/23886.html\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/23886.html#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\u9996\u9875\",\"item\":\"https:\/\/www.wsisp.com\/helps\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"\u4e00\u4e2a\u6bd4 Nginx \u8fd8\u7b80\u5355\u7684 Web \u670d\u52a1\u5668\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\",\"url\":\"https:\/\/www.wsisp.com\/helps\/\",\"name\":\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"description\":\"\u9999\u6e2f\u670d\u52a1\u5668_\u9999\u6e2f\u4e91\u670d\u52a1\u5668\u8d44\u8baf_\u670d\u52a1\u5668\u5e2e\u52a9\u6587\u6863_\u670d\u52a1\u5668\u6559\u7a0b\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.wsisp.com\/helps\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"zh-Hans\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\",\"name\":\"admin\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"zh-Hans\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery\",\"contentUrl\":\"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery\",\"caption\":\"admin\"},\"sameAs\":[\"http:\/\/wp.wsisp.com\"],\"url\":\"https:\/\/www.wsisp.com\/helps\/author\/admin\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"\u4e00\u4e2a\u6bd4 Nginx \u8fd8\u7b80\u5355\u7684 Web \u670d\u52a1\u5668 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.wsisp.com\/helps\/23886.html","og_locale":"zh_CN","og_type":"article","og_title":"\u4e00\u4e2a\u6bd4 Nginx \u8fd8\u7b80\u5355\u7684 Web \u670d\u52a1\u5668 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","og_description":"\u6587\u7ae0\u6d4f\u89c8\u9605\u8bfb1.5k\u6b21\uff0c\u70b9\u8d5e18\u6b21\uff0c\u6536\u85cf11\u6b21\u3002\u4f01\u4e1a\u7ea7\u7684 Web \u670d\u52a1\u5668\u975e\u5e38\u591a\uff0cNginx\u3001Tomcat\u3001Apache\u3001IIS\u3001FastAPI\u3001Flask \u7b49\u3002\u4eca\u5929\u677e\u54e5\u518d\u7ed9\u5927\u5bb6\u4ecb\u7ecd\u4e00\u4e2a\u5f00\u6e90\u7684 Web \u670d\u52a1\u5668\uff0c\u8fd9\u6b3e\u670d\u52a1\u5668\u5177\u5907\u81ea\u52a8 HTTPS \u529f\u80fd\u548c\u9ad8\u5ea6\u53ef\u914d\u7f6e\u6027\uff0c\u5b83\u7684\u540d\u5b57\u662f\uff1aCaddy\u3002Caddy \u662f\u4e00\u4e2a Go \u7f16\u5199\u7684 Web \u670d\u52a1\u5668\uff0c\u7c7b\u4f3c\u4e8e Nginx\uff0cCaddy \u63d0\u4f9b\u4e86\u66f4\u52a0\u5f3a\u5927\u7684\u529f\u80fd\uff0c\u968f\u7740 v2 \u7248\u672c\u53d1\u5e03\uff0cCaddy \u5df2\u7ecf\u53ef\u4ee5\u4f5c\u4e3a\u4e2d\u5c0f\u578b\u7ad9\u70b9 Web \u670d\u52a1\u5668\u7684\u53e6\u4e00\u4e2a\u9009\u62e9\u3002Caddy \u8f7b\u91cf\u7b80\u5355\uff0c\u5bf9\u65b0\u624b\u4e5f\u6bd4\u8f83\u53cb\u597d\uff0c\u6211\u4eec\u4e00\u8d77\u6765\u770b\u4e0b Caddy \u7684\u7528\u6cd5\u5427\u3002_caddy\u670d\u52a1\u5668","og_url":"https:\/\/www.wsisp.com\/helps\/23886.html","og_site_name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","article_published_time":"2025-04-19T00:42:25+00:00","author":"admin","twitter_card":"summary_large_image","twitter_misc":{"\u4f5c\u8005":"admin","\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4":"2 \u5206"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.wsisp.com\/helps\/23886.html","url":"https:\/\/www.wsisp.com\/helps\/23886.html","name":"\u4e00\u4e2a\u6bd4 Nginx \u8fd8\u7b80\u5355\u7684 Web \u670d\u52a1\u5668 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","isPartOf":{"@id":"https:\/\/www.wsisp.com\/helps\/#website"},"datePublished":"2025-04-19T00:42:25+00:00","dateModified":"2025-04-19T00:42:25+00:00","author":{"@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41"},"breadcrumb":{"@id":"https:\/\/www.wsisp.com\/helps\/23886.html#breadcrumb"},"inLanguage":"zh-Hans","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.wsisp.com\/helps\/23886.html"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.wsisp.com\/helps\/23886.html#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\u9996\u9875","item":"https:\/\/www.wsisp.com\/helps"},{"@type":"ListItem","position":2,"name":"\u4e00\u4e2a\u6bd4 Nginx \u8fd8\u7b80\u5355\u7684 Web \u670d\u52a1\u5668"}]},{"@type":"WebSite","@id":"https:\/\/www.wsisp.com\/helps\/#website","url":"https:\/\/www.wsisp.com\/helps\/","name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","description":"\u9999\u6e2f\u670d\u52a1\u5668_\u9999\u6e2f\u4e91\u670d\u52a1\u5668\u8d44\u8baf_\u670d\u52a1\u5668\u5e2e\u52a9\u6587\u6863_\u670d\u52a1\u5668\u6559\u7a0b","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.wsisp.com\/helps\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"zh-Hans"},{"@type":"Person","@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41","name":"admin","image":{"@type":"ImageObject","inLanguage":"zh-Hans","@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/image\/","url":"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery","contentUrl":"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery","caption":"admin"},"sameAs":["http:\/\/wp.wsisp.com"],"url":"https:\/\/www.wsisp.com\/helps\/author\/admin"}]}},"_links":{"self":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/23886","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/comments?post=23886"}],"version-history":[{"count":0,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/23886\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/media?parent=23886"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/categories?post=23886"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/tags?post=23886"},{"taxonomy":"topic","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/topic?post=23886"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}