{"id":37008,"date":"2025-05-13T16:26:04","date_gmt":"2025-05-13T08:26:04","guid":{"rendered":"https:\/\/www.wsisp.com\/helps\/37008.html"},"modified":"2025-05-13T16:26:04","modified_gmt":"2025-05-13T08:26:04","slug":"https-%e8%b4%9f%e8%bd%bd%e5%9d%87%e8%a1%a1-%e8%ae%bf%e9%97%ae%e5%90%8c%e4%b8%80%e6%9c%8d%e5%8a%a1%e5%99%a8%e4%b8%8a%e4%b8%a4%e4%b8%aa-fastapi-%e7%a8%8b%e5%ba%8f","status":"publish","type":"post","link":"https:\/\/www.wsisp.com\/helps\/37008.html","title":{"rendered":"HTTPS \u8d1f\u8f7d\u5747\u8861 \u8bbf\u95ee\u540c\u4e00\u670d\u52a1\u5668\u4e0a\u4e24\u4e2a FastAPI \u7a0b\u5e8f"},"content":{"rendered":"<\/p>\n<h4>HTTPS \u8d1f\u8f7d\u5747\u8861 \u8bbf\u95ee\u540c\u4e00\u670d\u52a1\u5668\u4e0a\u4e24\u4e2a FastAPI \u7a0b\u5e8f<\/h4>\n<ul>\n<li>\n<ul>\n<li>\n<ul>\n<li>**\u4e00\u3001\u67b6\u6784\u8bf4\u660e**<\/li>\n<li>**\u4e8c\u3001\u914d\u7f6e HTTPS \u8d1f\u8f7d\u5747\u8861**<\/li>\n<li>\n<ul>\n<li>**1. \u83b7\u53d6 SSL \u8bc1\u4e66&#xff08;\u4ee5 Let&#039;s Encrypt \u4e3a\u4f8b&#xff09;**<\/li>\n<li>**2. \u914d\u7f6e Nginx HTTPS \u53cd\u5411\u4ee3\u7406\u4e0e\u8d1f\u8f7d\u5747\u8861**<\/li>\n<li>**3. \u91cd\u8f7d Nginx \u914d\u7f6e**<\/li>\n<\/ul>\n<\/li>\n<li>**\u4e09\u3001\u9a8c\u8bc1 HTTPS \u8d1f\u8f7d\u5747\u8861**<\/li>\n<li>\n<ul>\n<li>**1. \u6d4b\u8bd5\u8bf7\u6c42\u5206\u53d1**<\/li>\n<li>**2. \u67e5\u770b Nginx \u65e5\u5fd7**<\/li>\n<li>**3. \u68c0\u67e5 SSL \u8bc1\u4e66\u6709\u6548\u6027**<\/li>\n<\/ul>\n<\/li>\n<li>**\u56db\u3001\u9ad8\u7ea7\u914d\u7f6e**<\/li>\n<li>\n<ul>\n<li>**1. \u57fa\u4e8e\u8def\u5f84\u7684\u8def\u7531\u5206\u53d1**<\/li>\n<li>**2. \u5065\u5eb7\u68c0\u67e5&#xff08;\u4e3b\u52a8\u6a21\u5f0f&#xff09;**<\/li>\n<li>**3. \u4f1a\u8bdd\u4fdd\u6301&#xff08;Session Persistence&#xff09;**<\/li>\n<\/ul>\n<\/li>\n<li>**\u4e94\u3001\u6545\u969c\u6392\u67e5**<\/li>\n<li>**\u516d\u3001\u81ea\u52a8\u5316\u90e8\u7f72&#xff08;\u53c2\u8003\u811a\u672c&#xff09;**<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<p>\u4ee5\u4e0b\u662f\u914d\u7f6e HTTPS \u8d1f\u8f7d\u5747\u8861 \u8bbf\u95ee\u540c\u4e00\u670d\u52a1\u5668\u4e0a\u4e24\u4e2a FastAPI \u7a0b\u5e8f\u7684\u8be6\u7ec6\u6b65\u9aa4&#xff0c;\u6db5\u76d6 Nginx \u914d\u7f6e\u3001SSL \u8bc1\u4e66\u7533\u8bf7 \u53ca \u8d1f\u8f7d\u5747\u8861\u7b56\u7565&#xff1a;<\/p>\n<hr \/>\n<h4>\u4e00\u3001\u67b6\u6784\u8bf4\u660e<\/h4>\n<p>\u2022 \u670d\u52a1\u5668\u73af\u5883&#xff1a;\u5355\u53f0\u670d\u52a1\u5668\u8fd0\u884c\u4e24\u4e2a FastAPI \u7a0b\u5e8f&#xff0c;\u5206\u522b\u76d1\u542c 127.0.0.1:8000 \u548c 127.0.0.1:8001\u3002 \u2022 Nginx \u89d2\u8272&#xff1a; \u2022 \u4f5c\u4e3a HTTPS \u7ec8\u6b62\u70b9&#xff08;\u5904\u7406 SSL \u52a0\u5bc6&#xff09;\u3002 \u2022 \u901a\u8fc7\u53cd\u5411\u4ee3\u7406\u5c06\u8bf7\u6c42\u8d1f\u8f7d\u5747\u8861\u5230\u4e24\u4e2a FastAPI \u5e94\u7528\u3002<\/p>\n<hr \/>\n<h4>\u4e8c\u3001\u914d\u7f6e HTTPS \u8d1f\u8f7d\u5747\u8861<\/h4>\n<h5>1. \u83b7\u53d6 SSL \u8bc1\u4e66&#xff08;\u4ee5 Let\u2019s Encrypt \u4e3a\u4f8b&#xff09;<\/h5>\n<p><span class=\"token comment\"># \u5b89\u88c5 Certbot<\/span><br \/>\n<span class=\"token function\">sudo<\/span> <span class=\"token function\">apt<\/span> <span class=\"token function\">install<\/span> certbot python3-certbot-nginx<\/p>\n<p><span class=\"token comment\"># \u7533\u8bf7\u8bc1\u4e66&#xff08;\u66ff\u6362\u4e3a\u60a8\u7684\u57df\u540d&#xff09;<\/span><br \/>\n<span class=\"token function\">sudo<\/span> certbot certonly &#8211;standalone -d example.com<\/p>\n<p>\u8bc1\u4e66\u8def\u5f84&#xff1a; \u2022 \u516c\u94a5&#xff1a;\/etc\/letsencrypt\/live\/example.com\/fullchain.pem \u2022 \u79c1\u94a5&#xff1a;\/etc\/letsencrypt\/live\/example.com\/privkey.pem<\/p>\n<hr \/>\n<h5>2. \u914d\u7f6e Nginx HTTPS \u53cd\u5411\u4ee3\u7406\u4e0e\u8d1f\u8f7d\u5747\u8861<\/h5>\n<p># \/etc\/nginx\/conf.d\/fastapi-ssl.conf<\/p>\n<p># HTTP \u91cd\u5b9a\u5411\u5230 HTTPS<br \/>\nserver {<br \/>\n    listen 80;<br \/>\n    server_name example.com;<br \/>\n    return 301 https:\/\/$host$request_uri;<br \/>\n}<\/p>\n<p># HTTPS \u4e3b\u914d\u7f6e<br \/>\nserver {<br \/>\n    listen 443 ssl;<br \/>\n    server_name example.com;<\/p>\n<p>    # SSL \u8bc1\u4e66\u914d\u7f6e<br \/>\n    ssl_certificate \/etc\/letsencrypt\/live\/example.com\/fullchain.pem;<br \/>\n    ssl_certificate_key \/etc\/letsencrypt\/live\/example.com\/privkey.pem;<br \/>\n    ssl_protocols TLSv1.2 TLSv1.3;<br \/>\n    ssl_ciphers ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256;<br \/>\n    ssl_prefer_server_ciphers on;<\/p>\n<p>    # \u8d1f\u8f7d\u5747\u8861\u914d\u7f6e<br \/>\n    upstream fastapi_backend {<br \/>\n        # \u6743\u91cd\u5206\u914d&#xff08;\u53ef\u9009&#xff09;<br \/>\n        server 127.0.0.1:8000 weight&#061;3;  # \u5e94\u75281&#xff0c;\u6743\u91cd 3<br \/>\n        server 127.0.0.1:8001 weight&#061;1;  # \u5e94\u75282&#xff0c;\u6743\u91cd 1<br \/>\n    }<\/p>\n<p>    # \u53cd\u5411\u4ee3\u7406\u89c4\u5219<br \/>\n    location \/ {<br \/>\n        proxy_pass http:\/\/fastapi_backend;<br \/>\n        proxy_set_header Host $host;<br \/>\n        proxy_set_header X-Real-IP $remote_addr;<br \/>\n        proxy_set_header X-Forwarded-Proto $scheme;  # \u4f20\u9012 HTTPS \u534f\u8bae\u4fe1\u606f<\/p>\n<p>        # WebSocket \u652f\u6301&#xff08;\u82e5 FastAPI \u4f7f\u7528 WebSocket&#xff09;<br \/>\n        proxy_http_version 1.1;<br \/>\n        proxy_set_header Upgrade $http_upgrade;<br \/>\n        proxy_set_header Connection &#034;upgrade&#034;;<br \/>\n    }<\/p>\n<p>    # \u5065\u5eb7\u68c0\u67e5\u7aef\u70b9&#xff08;\u53ef\u9009&#xff09;<br \/>\n    location \/health {<br \/>\n        proxy_pass http:\/\/fastapi_backend\/health;<br \/>\n        proxy_set_header Host $host;<br \/>\n    }<br \/>\n}<\/p>\n<hr \/>\n<h5>3. \u91cd\u8f7d Nginx \u914d\u7f6e<\/h5>\n<p><span class=\"token function\">sudo<\/span> nginx -t <span class=\"token operator\">&amp;&amp;<\/span> <span class=\"token function\">sudo<\/span> systemctl reload nginx<\/p>\n<hr \/>\n<h4>\u4e09\u3001\u9a8c\u8bc1 HTTPS \u8d1f\u8f7d\u5747\u8861<\/h4>\n<h5>1. \u6d4b\u8bd5\u8bf7\u6c42\u5206\u53d1<\/h5>\n<p><span class=\"token comment\"># \u6a21\u62df 10 \u6b21\u8bf7\u6c42&#xff0c;\u89c2\u5bdf\u6d41\u91cf\u5206\u914d<\/span><br \/>\n<span class=\"token keyword\">for<\/span> <span class=\"token for-or-select variable\">i<\/span> <span class=\"token keyword\">in<\/span> <span class=\"token punctuation\">{<\/span><span class=\"token number\">1<\/span><span class=\"token punctuation\">..<\/span><span class=\"token number\">10<\/span><span class=\"token punctuation\">}<\/span><span class=\"token punctuation\">;<\/span> <span class=\"token keyword\">do<\/span><br \/>\n    <span class=\"token function\">curl<\/span> -k https:\/\/example.com<br \/>\n<span class=\"token keyword\">done<\/span><\/p>\n<p>\u2022 \u9884\u671f\u7ed3\u679c&#xff1a;\u7ea6 75% \u8bf7\u6c42\u5230 8000 \u7aef\u53e3&#xff0c;25% \u5230 8001 \u7aef\u53e3\u3002<\/p>\n<h5>2. \u67e5\u770b Nginx \u65e5\u5fd7<\/h5>\n<p><span class=\"token function\">tail<\/span> -f \/var\/log\/nginx\/access.log <span class=\"token operator\">|<\/span> <span class=\"token function\">awk<\/span> <span class=\"token string\">&#039;{print <span class=\"token variable\">$upstream_addr<\/span>}&#039;<\/span><\/p>\n<p>\u2022 \u8f93\u51fa\u793a\u4f8b&#xff1a;<\/p>\n<p>127.0.0.1:8000<br \/>\n127.0.0.1:8000<br \/>\n127.0.0.1:8001<br \/>\n&#8230;<\/p>\n<h5>3. \u68c0\u67e5 SSL \u8bc1\u4e66\u6709\u6548\u6027<\/h5>\n<p><span class=\"token comment\"># \u4f7f\u7528 OpenSSL \u9a8c\u8bc1<\/span><br \/>\nopenssl s_client -connect example.com:443 -servername example.com<\/p>\n<p>\u2022 \u786e\u8ba4\u8f93\u51fa\u4e2d\u663e\u793a Verify return code: 0 (ok)\u3002<\/p>\n<hr \/>\n<h4>\u56db\u3001\u9ad8\u7ea7\u914d\u7f6e<\/h4>\n<h5>1. \u57fa\u4e8e\u8def\u5f84\u7684\u8def\u7531\u5206\u53d1<\/h5>\n<p>\u82e5\u9700\u6309 URL \u8def\u5f84\u533a\u5206\u5e94\u7528&#xff08;\u5982 \/app1 \u548c \/app2&#xff09;&#xff1a;<\/p>\n<p>server {<br \/>\n    listen 443 ssl;<br \/>\n    server_name example.com;<\/p>\n<p>    # &#8230; SSL \u914d\u7f6e\u540c\u4e0a &#8230;<\/p>\n<p>    # \u8def\u7531\u5230\u5e94\u75281<br \/>\n    location \/app1\/ {<br \/>\n        proxy_pass http:\/\/127.0.0.1:8000\/;<br \/>\n    }<\/p>\n<p>    # \u8def\u7531\u5230\u5e94\u75282<br \/>\n    location \/app2\/ {<br \/>\n        proxy_pass http:\/\/127.0.0.1:8001\/;<br \/>\n    }<br \/>\n}<\/p>\n<h5>2. \u5065\u5eb7\u68c0\u67e5&#xff08;\u4e3b\u52a8\u6a21\u5f0f&#xff09;<\/h5>\n<p>\u4f7f\u7528\u7b2c\u4e09\u65b9\u6a21\u5757\u6216 Nginx Plus&#xff1a;<\/p>\n<p>upstream fastapi_backend {<br \/>\n    server 127.0.0.1:8000;<br \/>\n    server 127.0.0.1:8001;<\/p>\n<p>    check interval&#061;3000 rise&#061;2 fall&#061;3 timeout&#061;1000 type&#061;http;<br \/>\n    check_http_send &#034;HEAD \/health HTTP\/1.1\\\\r\\\\nHost: example.com\\\\r\\\\n\\\\r\\\\n&#034;;<br \/>\n    check_http_expect_alive http_2xx http_3xx;<br \/>\n}<\/p>\n<h5>3. \u4f1a\u8bdd\u4fdd\u6301&#xff08;Session Persistence&#xff09;<\/h5>\n<p>\u4f7f\u7528 ip_hash \u6216 sticky \u6a21\u5757&#xff1a;<\/p>\n<p>upstream fastapi_backend {<br \/>\n    ip_hash;  # \u540c\u4e00\u5ba2\u6237\u7aef IP \u56fa\u5b9a\u8bbf\u95ee\u540c\u4e00\u540e\u7aef<br \/>\n    server 127.0.0.1:8000;<br \/>\n    server 127.0.0.1:8001;<br \/>\n}<\/p>\n<hr \/>\n<h4>\u4e94\u3001\u6545\u969c\u6392\u67e5<\/h4>\n<table>\n<tr>\u95ee\u9898\u73b0\u8c61\u89e3\u51b3\u65b9\u6848<\/tr>\n<tbody>\n<tr>\n<td>SSL_ERROR_BAD_CERT_DOMAIN<\/td>\n<td>\u786e\u4fdd\u8bc1\u4e66\u57df\u540d\u4e0e\u8bbf\u95ee\u57df\u540d\u4e00\u81f4&#xff0c;\u6216\u4f7f\u7528\u901a\u914d\u7b26\u8bc1\u4e66 (*.example.com)<\/td>\n<\/tr>\n<tr>\n<td>502 Bad Gateway<\/td>\n<td>\u68c0\u67e5 FastAPI \u5e94\u7528\u662f\u5426\u8fd0\u884c&#xff0c;Nginx \u9519\u8bef\u65e5\u5fd7 \/var\/log\/nginx\/error.log<\/td>\n<\/tr>\n<tr>\n<td>\u6d41\u91cf\u672a\u6309\u6743\u91cd\u5206\u914d<\/td>\n<td>\u786e\u8ba4\u540e\u7aef\u670d\u52a1\u5668\u5065\u5eb7\u72b6\u6001&#xff0c;\u68c0\u67e5 weight \u53c2\u6570\u662f\u5426\u751f\u6548<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<hr \/>\n<h4>\u516d\u3001\u81ea\u52a8\u5316\u90e8\u7f72&#xff08;\u53c2\u8003\u811a\u672c&#xff09;<\/h4>\n<p><span class=\"token shebang important\">#!\/bin\/bash<\/span><br \/>\n<span class=\"token comment\"># \u81ea\u52a8\u66f4\u65b0\u8bc1\u4e66\u5e76\u91cd\u8f7d Nginx<\/span><br \/>\ncertbot renew &#8211;quiet<br \/>\nsystemctl reload nginx<\/p>\n<hr \/>\n","protected":false},"excerpt":{"rendered":"<p>\u6587\u7ae0\u6d4f\u89c8\u9605\u8bfb976\u6b21\uff0c\u70b9\u8d5e36\u6b21\uff0c\u6536\u85cf23\u6b21\u3002\u901a\u8fc7\u4ee5\u4e0a\u6b65\u9aa4\uff0c\u60a8\u53ef\u4ee5\u901a\u8fc7 HTTPS \u8d1f\u8f7d\u5747\u8861\u5b89\u5168\u5730\u8bbf\u95ee\u4e24\u4e2a FastAPI \u5e94\u7528\uff0c\u540c\u65f6\u5b9e\u73b0\u7075\u6d3b\u7684\u6d41\u91cf\u7ba1\u7406\u548c\u9ad8\u53ef\u7528\u6027\u3002\u8bbf\u95ee\u540c\u4e00\u670d\u52a1\u5668\u4e0a\u4e24\u4e2a FastAPI \u7a0b\u5e8f\u7684\u8be6\u7ec6\u6b65\u9aa4\uff0c\u6db5\u76d6\u3002\u2022 \u901a\u8fc7\u53cd\u5411\u4ee3\u7406\u5c06\u8bf7\u6c42\u8d1f\u8f7d\u5747\u8861\u5230\u4e24\u4e2a FastAPI \u5e94\u7528\u3002\uff1a\u5355\u53f0\u670d\u52a1\u5668\u8fd0\u884c\u4e24\u4e2a FastAPI \u7a0b\u5e8f\uff0c\u5206\u522b\u76d1\u542c\u3002\u2022 \u4f5c\u4e3a HTTPS \u7ec8\u6b62\u70b9\uff08\u5904\u7406 SSL \u52a0\u5bc6\uff09\u3002\u82e5\u9700\u6309 URL \u8def\u5f84\u533a\u5206\u5e94\u7528\uff08\u5982\u3002\uff1a\u7ea6 75% \u8bf7\u6c42\u5230\u3002_nginx \u8d1f\u8f7d\u5747\u8861fastapi<\/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":[622,258],"topic":[],"class_list":["post-37008","post","type-post","status-publish","format-standard","hentry","category-server","tag-https","tag-258"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v20.3 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>HTTPS \u8d1f\u8f7d\u5747\u8861 \u8bbf\u95ee\u540c\u4e00\u670d\u52a1\u5668\u4e0a\u4e24\u4e2a FastAPI \u7a0b\u5e8f - \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\/37008.html\" \/>\n<meta property=\"og:locale\" content=\"zh_CN\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"HTTPS \u8d1f\u8f7d\u5747\u8861 \u8bbf\u95ee\u540c\u4e00\u670d\u52a1\u5668\u4e0a\u4e24\u4e2a FastAPI \u7a0b\u5e8f - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"og:description\" content=\"\u6587\u7ae0\u6d4f\u89c8\u9605\u8bfb976\u6b21\uff0c\u70b9\u8d5e36\u6b21\uff0c\u6536\u85cf23\u6b21\u3002\u901a\u8fc7\u4ee5\u4e0a\u6b65\u9aa4\uff0c\u60a8\u53ef\u4ee5\u901a\u8fc7 HTTPS \u8d1f\u8f7d\u5747\u8861\u5b89\u5168\u5730\u8bbf\u95ee\u4e24\u4e2a FastAPI \u5e94\u7528\uff0c\u540c\u65f6\u5b9e\u73b0\u7075\u6d3b\u7684\u6d41\u91cf\u7ba1\u7406\u548c\u9ad8\u53ef\u7528\u6027\u3002\u8bbf\u95ee\u540c\u4e00\u670d\u52a1\u5668\u4e0a\u4e24\u4e2a FastAPI \u7a0b\u5e8f\u7684\u8be6\u7ec6\u6b65\u9aa4\uff0c\u6db5\u76d6\u3002\u2022 \u901a\u8fc7\u53cd\u5411\u4ee3\u7406\u5c06\u8bf7\u6c42\u8d1f\u8f7d\u5747\u8861\u5230\u4e24\u4e2a FastAPI \u5e94\u7528\u3002\uff1a\u5355\u53f0\u670d\u52a1\u5668\u8fd0\u884c\u4e24\u4e2a FastAPI \u7a0b\u5e8f\uff0c\u5206\u522b\u76d1\u542c\u3002\u2022 \u4f5c\u4e3a HTTPS \u7ec8\u6b62\u70b9\uff08\u5904\u7406 SSL \u52a0\u5bc6\uff09\u3002\u82e5\u9700\u6309 URL \u8def\u5f84\u533a\u5206\u5e94\u7528\uff08\u5982\u3002\uff1a\u7ea6 75% \u8bf7\u6c42\u5230\u3002_nginx \u8d1f\u8f7d\u5747\u8861fastapi\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.wsisp.com\/helps\/37008.html\" \/>\n<meta property=\"og:site_name\" content=\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"article:published_time\" content=\"2025-05-13T08:26:04+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\/37008.html\",\"url\":\"https:\/\/www.wsisp.com\/helps\/37008.html\",\"name\":\"HTTPS \u8d1f\u8f7d\u5747\u8861 \u8bbf\u95ee\u540c\u4e00\u670d\u52a1\u5668\u4e0a\u4e24\u4e2a FastAPI \u7a0b\u5e8f - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"isPartOf\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\"},\"datePublished\":\"2025-05-13T08:26:04+00:00\",\"dateModified\":\"2025-05-13T08:26:04+00:00\",\"author\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\"},\"breadcrumb\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/37008.html#breadcrumb\"},\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.wsisp.com\/helps\/37008.html\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/37008.html#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\u9996\u9875\",\"item\":\"https:\/\/www.wsisp.com\/helps\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"HTTPS \u8d1f\u8f7d\u5747\u8861 \u8bbf\u95ee\u540c\u4e00\u670d\u52a1\u5668\u4e0a\u4e24\u4e2a FastAPI \u7a0b\u5e8f\"}]},{\"@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":"HTTPS \u8d1f\u8f7d\u5747\u8861 \u8bbf\u95ee\u540c\u4e00\u670d\u52a1\u5668\u4e0a\u4e24\u4e2a FastAPI \u7a0b\u5e8f - \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\/37008.html","og_locale":"zh_CN","og_type":"article","og_title":"HTTPS \u8d1f\u8f7d\u5747\u8861 \u8bbf\u95ee\u540c\u4e00\u670d\u52a1\u5668\u4e0a\u4e24\u4e2a FastAPI \u7a0b\u5e8f - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","og_description":"\u6587\u7ae0\u6d4f\u89c8\u9605\u8bfb976\u6b21\uff0c\u70b9\u8d5e36\u6b21\uff0c\u6536\u85cf23\u6b21\u3002\u901a\u8fc7\u4ee5\u4e0a\u6b65\u9aa4\uff0c\u60a8\u53ef\u4ee5\u901a\u8fc7 HTTPS \u8d1f\u8f7d\u5747\u8861\u5b89\u5168\u5730\u8bbf\u95ee\u4e24\u4e2a FastAPI \u5e94\u7528\uff0c\u540c\u65f6\u5b9e\u73b0\u7075\u6d3b\u7684\u6d41\u91cf\u7ba1\u7406\u548c\u9ad8\u53ef\u7528\u6027\u3002\u8bbf\u95ee\u540c\u4e00\u670d\u52a1\u5668\u4e0a\u4e24\u4e2a FastAPI \u7a0b\u5e8f\u7684\u8be6\u7ec6\u6b65\u9aa4\uff0c\u6db5\u76d6\u3002\u2022 \u901a\u8fc7\u53cd\u5411\u4ee3\u7406\u5c06\u8bf7\u6c42\u8d1f\u8f7d\u5747\u8861\u5230\u4e24\u4e2a FastAPI \u5e94\u7528\u3002\uff1a\u5355\u53f0\u670d\u52a1\u5668\u8fd0\u884c\u4e24\u4e2a FastAPI \u7a0b\u5e8f\uff0c\u5206\u522b\u76d1\u542c\u3002\u2022 \u4f5c\u4e3a HTTPS \u7ec8\u6b62\u70b9\uff08\u5904\u7406 SSL \u52a0\u5bc6\uff09\u3002\u82e5\u9700\u6309 URL \u8def\u5f84\u533a\u5206\u5e94\u7528\uff08\u5982\u3002\uff1a\u7ea6 75% \u8bf7\u6c42\u5230\u3002_nginx \u8d1f\u8f7d\u5747\u8861fastapi","og_url":"https:\/\/www.wsisp.com\/helps\/37008.html","og_site_name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","article_published_time":"2025-05-13T08:26:04+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\/37008.html","url":"https:\/\/www.wsisp.com\/helps\/37008.html","name":"HTTPS \u8d1f\u8f7d\u5747\u8861 \u8bbf\u95ee\u540c\u4e00\u670d\u52a1\u5668\u4e0a\u4e24\u4e2a FastAPI \u7a0b\u5e8f - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","isPartOf":{"@id":"https:\/\/www.wsisp.com\/helps\/#website"},"datePublished":"2025-05-13T08:26:04+00:00","dateModified":"2025-05-13T08:26:04+00:00","author":{"@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41"},"breadcrumb":{"@id":"https:\/\/www.wsisp.com\/helps\/37008.html#breadcrumb"},"inLanguage":"zh-Hans","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.wsisp.com\/helps\/37008.html"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.wsisp.com\/helps\/37008.html#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\u9996\u9875","item":"https:\/\/www.wsisp.com\/helps"},{"@type":"ListItem","position":2,"name":"HTTPS \u8d1f\u8f7d\u5747\u8861 \u8bbf\u95ee\u540c\u4e00\u670d\u52a1\u5668\u4e0a\u4e24\u4e2a FastAPI \u7a0b\u5e8f"}]},{"@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\/37008","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=37008"}],"version-history":[{"count":0,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/37008\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/media?parent=37008"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/categories?post=37008"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/tags?post=37008"},{"taxonomy":"topic","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/topic?post=37008"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}