{"id":30513,"date":"2026-03-03T16:22:06","date_gmt":"2026-03-03T08:22:06","guid":{"rendered":"https:\/\/www.varidata.com\/uncategorized-zh-tw\/how-to-set-up-https-redirect-with-apache-behind-nginx\/"},"modified":"2026-03-03T16:24:01","modified_gmt":"2026-03-03T08:24:01","slug":"how-to-set-up-https-redirect-with-apache-behind-nginx","status":"publish","type":"post","link":"https:\/\/www.varidata.com\/zh-tw\/blog-tc\/how-to-set-up-https-redirect-with-apache-behind-nginx\/","title":{"rendered":"\u5728 Nginx \u524d\u7f6e Apache \u6642\u5982\u4f55\u914d\u7f6e HTTPS \u91cd\u65b0\u5c0e\u5411"},"content":{"rendered":"<style>\n    table, th, td {\n        border: 1px solid black;\n        border-collapse: collapse;\n    }\n<\/style>\n<p>\u82e5\u8981\u7372\u5f97\u6700\u53ef\u9760\u7684 HTTPS \u91cd\u65b0\u5c0e\u5411\u6548\u679c\uff0c\u6700\u4f73\u5be6\u52d9\u662f\u8b93 Nginx \u7d71\u4e00\u8655\u7406 HTTPS \u4ee5\u53ca\u6240\u6709 <a target=\"_blank\" href=\"https:\/\/www.varidata.com\/zh-tw\/knowledge-tc\/http%e5%92%8chttps%e6%9c%89%e4%bb%80%e9%ba%bc%e5%8d%80%e5%88%a5%ef%bc%9f\/\">HTTP \u5230 HTTPS<\/a> \u7684\u91cd\u65b0\u5c0e\u5411\uff0c\u7279\u5225\u662f\u5728\u70ba <a target=\"_blank\" href=\"https:\/\/www.varidata.com\/zh-tw\/server\/los-angeles\/cn2\/\">\u7f8e\u570b\u4f3a\u670d\u5668\u79df\u7528<\/a> \u74b0\u5883\u63d0\u4f9b\u524d\u7aef\u4ee3\u7406\u6642\u3002Apache \u53ea\u9700\u4fe1\u4efb\u4ee3\u7406\u6a19\u982d\uff0c\u5c31\u80fd\u6b63\u78ba\u8fa8\u8b58\u5354\u5b9a\u985e\u578b\uff0c\u5f9e\u800c\u907f\u514d\u91cd\u65b0\u5c0e\u5411\u5faa\u74b0\u3002\u5e38\u898b\u7684\u91cd\u65b0\u5c0e\u5411\u5faa\u74b0\u539f\u56e0\u5305\u62ec\uff1a<\/p>\n<ol>\n<li>\n<p>\u5728\u591a\u5c64\u74b0\u5883\u4e2d\u932f\u8aa4\u914d\u7f6e SSL \u6216 HTTPS<\/p>\n<\/li>\n<li>\n<p>\u53cd\u5411\u4ee3\u7406\u6216 CDN \u914d\u7f6e\u932f\u8aa4<\/p>\n<\/li>\n<li>\n<p>\u5e73\u53f0\u6216\u6846\u67b6\u7279\u5b9a\u7684\u932f\u8aa4<\/p>\n<\/li>\n<li>\n<p>www \u8207\u975e www \u7db2\u57df\u7248\u672c\u898f\u5247\u885d\u7a81<\/p>\n<\/li>\n<li>\n<p>\u904e\u671f\u6216\u7570\u5e38\u7684 Cookie \u6216\u700f\u89bd\u5668\u5feb\u53d6<\/p>\n<\/li>\n<li>\n<p>HSTS\uff08HTTP \u56b4\u683c\u50b3\u8f38\u5b89\u5168\uff09\u7b56\u7565\u554f\u984c<\/p>\n<\/li>\n<\/ol>\n<p>\u696d\u754c\u901a\u884c\u4f5c\u6cd5\u662f\uff1a\u5c07\u6240\u6709\u7db2\u57df\u7d71\u4e00\u91cd\u65b0\u5c0e\u5411\u5230 HTTPS\uff0c\u70ba\u4e0d\u540c\u7db2\u57df\u4f7f\u7528\u7368\u7acb\u7684 server \u5340\u584a\uff0c\u4e26\u6aa2\u67e5\u8af8\u5982 <code>X-Forwarded-Proto<\/code> \u4e4b\u985e\u7684\u8acb\u6c42\u6a19\u982d\uff0c\u4ee5\u78ba\u4fdd\u6d41\u91cf\u5728\u5b89\u5168\u901a\u9053\u4e2d\u50b3\u8f38\u3002<\/p>\n<h2>\u8981\u9ede\u901f\u89bd<\/h2>\n<ul>\n<li>\n<p>\u4f7f\u7528 Nginx \u7d71\u4e00\u8655\u7406 HTTPS \u4ee5\u53ca HTTP \u5230 HTTPS \u7684\u91cd\u65b0\u5c0e\u5411\uff0c\u4ee5\u7372\u5f97\u66f4\u4f73\u7684\u5b89\u5168\u6027\u8207\u6548\u80fd\u3002<\/p>\n<\/li>\n<li>\n<p>\u52d9\u5fc5\u5f9e Nginx \u5411 Apache \u8f49\u9001\u6b63\u78ba\u7684\u4ee3\u7406\u6a19\u982d\uff0c\u907f\u514d\u91cd\u65b0\u5c0e\u5411\u5faa\u74b0\u4e26\u78ba\u4fdd\u7d00\u9304\u6a94\uff08log\uff09\u8a18\u9304\u7cbe\u6e96\u3002<\/p>\n<\/li>\n<li>\n<p>\u900f\u904e Certbot \u5b89\u88dd SSL \u6191\u8b49\u4e26\u555f\u7528\u81ea\u52d5\u7e8c\u671f\uff0c\u78ba\u4fdd\u9023\u7dda\u59cb\u7d42\u5b89\u5168\u3002<\/p>\n<\/li>\n<li>\n<p>\u5728 Nginx \u4e2d\u914d\u7f6e 301 \u91cd\u65b0\u5c0e\u5411\uff0c\u5f37\u5236\u6240\u6709\u6d41\u91cf\u4f7f\u7528 HTTPS\uff0c\u6709\u52a9\u65bc SEO \u8207\u4f7f\u7528\u8005\u4fe1\u4efb\u3002<\/p>\n<\/li>\n<li>\n<p>\u5b9a\u671f\u6e2c\u8a66\u914d\u7f6e\u4e26\u76e3\u63a7\u554f\u984c\uff0c\u4f8b\u5982\u91cd\u65b0\u5c0e\u5411\u5faa\u74b0\u4ee5\u53ca\u6df7\u5408\u5167\u5bb9\uff08Mixed Content\uff09\u8b66\u793a\u3002<\/p>\n<\/li>\n<\/ul>\n<h2>Nginx + Apache \u53cd\u5411\u4ee3\u7406\u67b6\u69cb<\/h2>\n<h3>\u53cd\u5411\u4ee3\u7406\u60c5\u5883\u4e0b\u7684 HTTPS \u904b\u4f5c\u65b9\u5f0f<\/h3>\n<p>\u7576\u4f60\u4f7f\u7528 Nginx \u4f5c\u70ba Apache \u524d\u7aef\u7684\u53cd\u5411\u4ee3\u7406\u6642\uff0c\u5c31\u5efa\u7acb\u4e86\u4e00\u5957\u5f37\u5927\u800c\u5f48\u6027\u7684 Web \u670d\u52d9\u5806\u758a\u3002\u5728\u9019\u7a2e\u67b6\u69cb\u4e2d\uff0cNginx \u6703\u63a5\u6536\u6240\u6709\u4f86\u81ea\u4f7f\u7528\u8005\u7684\u8acb\u6c42\uff1a\u5b83\u6703\u76f4\u63a5\u63d0\u4f9b\u975c\u614b\u6a94\u6848\uff08\u5982\u5716\u7247\u3001CSS\uff09\uff0c\u800c\u52d5\u614b\u5167\u5bb9\u8acb\u6c42\u5247\u8f49\u9001\u7d66 Apache\u3002Apache \u8655\u7406\u5b8c\u8acb\u6c42\u5f8c\uff0c\u5c07\u7d50\u679c\u56de\u50b3\u7d66 Nginx\uff0c\u518d\u7531 Nginx \u56de\u61c9\u7d66\u4f7f\u7528\u8005\u3002\u5982\u6b64\u53ef\u4ee5\u986f\u8457\u6e1b\u8f15 Apache \u7684\u8ca0\u8f09\uff0c\u4e26\u8b93\u4f60\u66f4\u8f15\u9b06\u5730\u6c34\u5e73\u64f4\u5145\u5f8c\u7aef\u4f3a\u670d\u5668\u3002<\/p>\n<p>\u5c07 HTTPS \u4ea4\u7531 Nginx \u8655\u7406\uff0c\u4f60\u53ef\u4ee5\u7372\u5f97\u591a\u65b9\u9762\u7684\u597d\u8655\uff1a<\/p>\n<ul>\n<li>\n<p>Nginx \u5145\u7576\u524d\u7aef\u300c\u9632\u8b77\u76fe\u300d\uff0c\u9694\u96e2\u4f7f\u7528\u8005\u8207\u5f8c\u7aef\u4f3a\u670d\u5668\uff0c\u589e\u5f37\u6574\u9ad4\u5b89\u5168\u6027\u3002<\/p>\n<\/li>\n<li>\n<p>\u53ea\u9700\u5728 Nginx \u4e00\u8655\u7ba1\u7406 SSL \u6191\u8b49\uff0c\u66f4\u65b0\u8207\u7e8c\u671f\u90fd\u66f4\u7c21\u55ae\u3002<\/p>\n<\/li>\n<li>\n<p>\u5f8c\u7aef Apache \u50c5\u9700\u4f7f\u7528\u4e00\u822c HTTP\uff0c\u6e1b\u5c11\u52a0\u89e3\u5bc6\u8ca0\u64d4\uff0c\u9032\u800c\u63d0\u5347\u6548\u80fd\u3002<\/p>\n<\/li>\n<li>\n<p>\u8a31\u591a\u7522\u696d\u5c08\u5bb6\u90fd\u5efa\u8b70\u5728\u4ee3\u7406\u5c64\u7d42\u6b62 HTTPS\uff0c\u4ee5\u517c\u9867\u5b89\u5168\u8207\u901f\u5ea6\u3002<\/p>\n<\/li>\n<\/ul>\n<h3>\u6d41\u91cf\u8def\u5f91\u8207\u4ee3\u7406\u8acb\u6c42\u6a19\u982d<\/h3>\n<p>\u70ba\u4e86\u78ba\u4fdd\u7ad9\u9ede\u5b89\u5168\u4e26\u907f\u514d\u91cd\u65b0\u5c0e\u5411\u5faa\u74b0\uff0c\u4f60\u5fc5\u9808\u5f9e Nginx \u5411 Apache \u8f49\u9001\u6b63\u78ba\u7684\u8acb\u6c42\u6a19\u982d\u3002\u9019\u4e9b\u6a19\u982d\u8cc7\u8a0a\u5354\u52a9 Apache \u77ad\u89e3\u539f\u59cb\u8acb\u6c42\u7684\u7d30\u7bc0\uff0c\u4f8b\u5982\u4f7f\u7528\u7684\u5354\u5b9a\u4ee5\u53ca\u7528\u6236\u7aef IP \u4f4d\u5740\u3002\u82e5\u7f3a\u5c11\u9019\u4e9b\u8cc7\u8a0a\uff0cApache \u53ef\u80fd\u7121\u6cd5\u5224\u65b7\u8acb\u6c42\u662f\u5426\u4f86\u81ea HTTPS\uff0c\u9032\u800c\u5c0e\u81f4\u91cd\u65b0\u5c0e\u5411\u6216\u7d00\u9304\u6a94\u7570\u5e38\u3002<\/p>\n<p>\u4ee5\u4e0b\u662f\u4f60\u61c9\u7576\u8f49\u9001\u7684\u91cd\u8981\u4ee3\u7406\u8acb\u6c42\u6a19\u982d\u5217\u8868\uff1a<\/p>\n<div fullwidth=\"\" class=\"qc-default-table-wrapper \">\n<table style=\"min-width: 50px;\">\n<colgroup>\n<col style=\"min-width: 25px;\">\n<col style=\"min-width: 25px;\"><\/colgroup>\n<tbody>\n<tr>\n<th colspan=\"1\" rowspan=\"1\">\n<p>\u8acb\u6c42\u6a19\u982d\u540d\u7a31<\/p>\n<\/th>\n<th colspan=\"1\" rowspan=\"1\">\n<p>\u8aaa\u660e<\/p>\n<\/th>\n<\/tr>\n<tr>\n<td colspan=\"1\" rowspan=\"1\">\n<p>Host<\/p>\n<\/td>\n<td colspan=\"1\" rowspan=\"1\">\n<p>\u5c07 Host \u6a19\u982d\u8a2d\u5b9a\u70ba\u539f\u59cb\u5b58\u53d6\u7684\u4e3b\u6a5f\u540d\u7a31\u3002<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td colspan=\"1\" rowspan=\"1\">\n<p>X-Real-IP<\/p>\n<\/td>\n<td colspan=\"1\" rowspan=\"1\">\n<p>\u50b3\u905e\u7528\u6236\u7aef\u771f\u5be6 IP \u4f4d\u5740\u3002<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td colspan=\"1\" rowspan=\"1\">\n<p>X-Forwarded-For<\/p>\n<\/td>\n<td colspan=\"1\" rowspan=\"1\">\n<p>\u8f49\u9001\u539f\u59cb\u7528\u6236\u7aef IP\uff08\u4e26\u4fdd\u7559\u4ee3\u7406\u93c8\uff09\u3002<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td colspan=\"1\" rowspan=\"1\">\n<p>X-Forwarded-Proto<\/p>\n<\/td>\n<td colspan=\"1\" rowspan=\"1\">\n<p>\u6307\u660e\u539f\u59cb\u8acb\u6c42\u7684\u5354\u5b9a\uff08HTTP\/HTTPS\uff09\u3002<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td colspan=\"1\" rowspan=\"1\">\n<p>X-Forwarded-Host<\/p>\n<\/td>\n<td colspan=\"1\" rowspan=\"1\">\n<p>\u8f49\u9001\u7528\u6236\u7aef\u6700\u521d\u8acb\u6c42\u7684\u4e3b\u6a5f\u540d\u7a31\u3002<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td colspan=\"1\" rowspan=\"1\">\n<p>X-Forwarded-Port<\/p>\n<\/td>\n<td colspan=\"1\" rowspan=\"1\">\n<p>\u8f49\u9001\u7528\u6236\u7aef\u4f7f\u7528\u7684\u539f\u59cb\u9023\u63a5\u57e0\u3002<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td colspan=\"1\" rowspan=\"1\">\n<p>X-Forwarded-Server<\/p>\n<\/td>\n<td colspan=\"1\" rowspan=\"1\">\n<p>\u8f49\u9001\u4f3a\u670d\u5668\u540d\u7a31\u3002<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td colspan=\"1\" rowspan=\"1\">\n<p>X-Request-ID<\/p>\n<\/td>\n<td colspan=\"1\" rowspan=\"1\">\n<p>\u50b3\u905e\u552f\u4e00\u8acb\u6c42 ID\uff0c\u65b9\u4fbf\u8ffd\u8e64\u3002<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td colspan=\"1\" rowspan=\"1\">\n<p>Upgrade<\/p>\n<\/td>\n<td colspan=\"1\" rowspan=\"1\">\n<p>\u7528\u65bc WebSocket \u9023\u7dda\u5347\u7d1a\u3002<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td colspan=\"1\" rowspan=\"1\">\n<p>Connection<\/p>\n<\/td>\n<td colspan=\"1\" rowspan=\"1\">\n<p>\u914d\u5408 Upgrade \u7ba1\u7406\u9023\u7dda\u5347\u7d1a\u3002<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td colspan=\"1\" rowspan=\"1\">\n<p>Accept-Encoding<\/p>\n<\/td>\n<td colspan=\"1\" rowspan=\"1\">\n<p>\u63a7\u5236\u56de\u61c9\u4f7f\u7528\u7684\u58d3\u7e2e\u7de8\u78bc\u3002<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td colspan=\"1\" rowspan=\"1\">\n<p>X-Powered-By<\/p>\n<\/td>\n<td colspan=\"1\" rowspan=\"1\">\n<p>\u7528\u65bc\u96b1\u85cf\u5f8c\u7aef\u7684 X-Powered-By \u6a19\u982d\u3002<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td colspan=\"1\" rowspan=\"1\">\n<p>Server<\/p>\n<\/td>\n<td colspan=\"1\" rowspan=\"1\">\n<p>\u7528\u65bc\u96b1\u85cf\u5f8c\u7aef\u7684 Server \u6a19\u982d\u3002<\/p>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<blockquote>\n<p>\u63d0\u793a\uff1a\u52d9\u5fc5\u6aa2\u67e5\u4f60\u7684 Nginx \u914d\u7f6e\uff0c\u78ba\u8a8d\u4e0a\u8ff0\u9019\u4e9b\u8acb\u6c42\u6a19\u982d\u5df2\u6b63\u78ba\u8a2d\u5b9a\u3002\u9019\u80fd\u5354\u52a9 Apache \u8fa8\u8b58 HTTPS \u8acb\u6c42\uff0c\u8b93\u91cd\u65b0\u5c0e\u5411\u908f\u8f2f\u7a69\u5b9a\u53ef\u9760\u3002<\/p>\n<\/blockquote>\n<h2>\u914d\u7f6e HTTPS \u91cd\u65b0\u5c0e\u5411\u524d\u7684\u6e96\u5099\u5de5\u4f5c<\/h2>\n<h3>\u6240\u9700\u8edf\u9ad4\u8207\u5b58\u53d6\u6b0a\u9650<\/h3>\n<p>\u958b\u59cb\u4e4b\u524d\uff0c\u8acb\u78ba\u4fdd\u4f60\u64c1\u6709\u6b63\u78ba\u7684\u5de5\u5177\u548c\u8db3\u5920\u7684\u6b0a\u9650\u3002\u4f3a\u670d\u5668\u4e0a\u9700\u8981\u540c\u6642\u5b89\u88dd\u4e26\u57f7\u884c Nginx \u548c Apache\u3002\u4f60\u9084\u9700\u8981\u900f\u904e SSH \u767b\u5165\u4f3a\u670d\u5668\u7d42\u7aef\u6a5f\uff0c\u4e26\u5177\u5099 root \u6216 sudo \u6b0a\u9650\uff0c\u624d\u80fd\u4fee\u6539\u914d\u7f6e\u6a94\u8207\u91cd\u65b0\u555f\u52d5\u670d\u52d9\u3002\u5426\u5247\uff0c\u5c07\u7121\u6cd5\u5b8c\u6210\u6574\u5957\u90e8\u7f72\u3002<\/p>\n<p>\u4ee5\u4e0b\u662f\u4e00\u4efd\u7c21\u8981\u6aa2\u67e5\u6e05\u55ae\uff0c\u5354\u52a9\u4f60\u78ba\u8a8d\u74b0\u5883\u5c31\u7dd2\uff1a<\/p>\n<ul>\n<li>\n<p>Nginx \u5df2\u5b89\u88dd\u4e26\u4f5c\u70ba\u53cd\u5411\u4ee3\u7406\u57f7\u884c<\/p>\n<\/li>\n<li>\n<p>Apache \u5df2\u5b89\u88dd\u4e26\u4f5c\u70ba\u5f8c\u7aef\u4f3a\u670d\u5668\u57f7\u884c<\/p>\n<\/li>\n<li>\n<p>\u53ef\u4ee5\u5b58\u53d6\u4f3a\u670d\u5668\u7d42\u7aef\u6a5f\uff08SSH\uff09<\/p>\n<\/li>\n<li>\n<p>\u64c1\u6709\u7de8\u8f2f\u914d\u7f6e\u6a94\u8207\u91cd\u555f\u670d\u52d9\u7684 root \u6216 sudo \u6b0a\u9650<\/p>\n<\/li>\n<li>\n<p>\u6709\u4e00\u500b\u5df2\u89e3\u6790\u5230\u4f3a\u670d\u5668 IP \u7684\u7db2\u57df\u540d\u7a31<\/p>\n<\/li>\n<\/ul>\n<blockquote>\n<p>\u63d0\u793a\uff1a\u5728\u4fee\u6539\u4efb\u4f55\u914d\u7f6e\u6a94\u4e4b\u524d\uff0c\u52d9\u5fc5\u5148\u505a\u597d\u5099\u4efd\u3002\u4e00\u65e6\u51fa\u73fe\u554f\u984c\uff0c\u5099\u4efd\u53ef\u4ee5\u5354\u52a9\u4f60\u5feb\u901f\u6062\u5fa9\u7db2\u7ad9\u670d\u52d9\u3002<\/p>\n<\/blockquote>\n<h3>SSL \u6191\u8b49\u8207\u81ea\u7c3d\u6191\u8b49\u9078\u9805<\/h3>\n<p>\u8981\u4fdd\u8b77\u7ad9\u9ede\u5b89\u5168\uff0c\u4f60\u9700\u8981\u4e00\u5f35 SSL \u6191\u8b49\u3002\u53ef\u4ee5\u9078\u64c7\u7531\u6b0a\u5a01 CA\uff08\u6191\u8b49\u9812\u767c\u6a5f\u69cb\uff09\u7c3d\u767c\u7684\u5546\u696d\u6191\u8b49\uff0c\u4e5f\u53ef\u4ee5\u4f7f\u7528\u81ea\u7c3d\u6191\u8b49\u3002\u5169\u8005\u5404\u6709\u9069\u7528\u60c5\u5883\u8207\u512a\u7f3a\u9ede\u3002<\/p>\n<ul>\n<li>\n<p>\u81ea\u7c3d\u6191\u8b49\u9069\u5408\u500b\u4eba\u5c08\u6848\u6216\u5167\u90e8\u6e2c\u8a66\u74b0\u5883\u3002\u5b83\u5011\u5728\u52a0\u5bc6\u5c64\u9762\u662f\u5b89\u5168\u7684\uff0c\u4f46\u700f\u89bd\u5668\u4e0d\u6703\u4fe1\u4efb\uff0c\u82e5\u7528\u65bc\u516c\u958b\u7db2\u7ad9\uff0c\u5c07\u986f\u793a\u8b66\u544a\u3002<\/p>\n<\/li>\n<li>\n<p>\u7531 CA \u7c3d\u767c\u7684\u6191\u8b49\u65e2\u80fd\u52a0\u5bc6\u50b3\u8f38\uff0c\u53c8\u80fd\u9a57\u8b49\u4f3a\u670d\u5668\u8eab\u5206\uff0c\u9019\u7a2e\u4fe1\u4efb\u5c0d\u9762\u5411\u5927\u773e\u7684\u7ad9\u9ede\u81f3\u95dc\u91cd\u8981\u3002<\/p>\n<\/li>\n<li>\n<p>\u81ea\u7c3d\u6191\u8b49\u6703\u89f8\u767c\u700f\u89bd\u5668\u5b89\u5168\u8b66\u544a\uff0c\u4f7f\u7528\u8005\u5fc5\u9808\u4e3b\u52d5\u300c\u63a5\u53d7\u98a8\u96aa\u300d\u624d\u80fd\u7e7c\u7e8c\u700f\u89bd\uff0c\u9019\u5c0d\u96fb\u5546\u6216\u4f01\u696d\u7db2\u7ad9\u6975\u70ba\u4e0d\u5229\u3002<\/p>\n<\/li>\n<li>\n<p>\u5546\u696d\u6191\u8b49\u53ef\u4ee5\u6d88\u9664\u700f\u89bd\u5668\u8b66\u544a\uff0c\u8b93\u4f7f\u7528\u8005\u66f4\u5bb9\u6613\u4fe1\u4efb\u4f60\u7684\u7db2\u7ad9\u3002<\/p>\n<\/li>\n<\/ul>\n<p>\u5728 Nginx + Apache \u67b6\u69cb\u4e0b\u7ba1\u7406\u6191\u8b49\u6642\uff0c\u4f60\u61c9\u78ba\u4fdd\u6191\u8b49\u5728\u5230\u671f\u524d\u5b8c\u6210\u7e8c\u671f\u3002\u6700\u4f73\u5be6\u52d9\u662f\uff1a\u7522\u751f\u65b0\u7684 CSR\uff08\u6191\u8b49\u7c3d\u7f72\u8981\u6c42\uff09\uff0c\u63d0\u4ea4\u7d66 CA\uff0c\u5b89\u88dd\u66f4\u65b0\u5f8c\u7684\u6191\u8b49\u4e26\u91cd\u65b0\u555f\u52d5\u670d\u52d9\u3002\u5c07\u6b64\u6d41\u7a0b\u81ea\u52d5\u5316\u53ef\u4ee5\u7bc0\u7701\u6642\u9593\u4e26\u6301\u7e8c\u4fdd\u969c\u5b89\u5168\u3002<\/p>\n<blockquote>\n<p>\u6ce8\u610f\uff1a\u5728 Nginx \u4e2d\u4f7f\u7528\u7368\u7acb\u7684 server \u5340\u584a\u4f86\u8655\u7406 HTTP \u5230 HTTPS \u7684\u91cd\u65b0\u5c0e\u5411\u3002\u6b64\u4f5c\u6cd5\u9ad8\u6548\u3001\u6e05\u6670\u4e14\u53ef\u9760\u3002<\/p>\n<\/blockquote>\n<h2>Nginx \u4e2d\u7684 HTTPS \u91cd\u65b0\u5c0e\u5411\u914d\u7f6e<\/h2>\n<p>\u5728 Nginx \u4e2d\u914d\u7f6e HTTPS \u4e26\u7ba1\u7406\u91cd\u65b0\u5c0e\u5411\uff0c\u662f\u5efa\u69cb\u5b89\u5168\u3001\u7a69\u5b9a Web \u670d\u52d9\u7684\u95dc\u9375\u6b65\u9a5f\u3002\u4f60\u53ef\u4ee5\u900f\u904e Nginx \u865b\u64ec\u4e3b\u6a5f\u914d\u7f6e\uff08server \u5340\u584a\uff09\u63a7\u5236\u4f3a\u670d\u5668\u5982\u4f55\u8655\u7406\u8acb\u6c42\u4ee5\u53ca\u5982\u4f55\u8f49\u9001\u5230 Apache\u3002\u672c\u7bc0\u5c07\u5f15\u5c0e\u4f60\u5b8c\u6210\u555f\u7528 HTTPS\u3001\u8a2d\u5b9a HTTP \u5230 HTTPS \u91cd\u65b0\u5c0e\u5411\u4ee5\u53ca\u8f49\u9001\u4ee3\u7406\u8acb\u6c42\u6a19\u982d\u3002<\/p>\n<h3>\u5728 Nginx \u4e2d\u555f\u7528 HTTPS<\/h3>\n<p>\u4f60\u9700\u8981\u5728 Nginx \u4e2d\u555f\u7528 HTTPS \u4f86\u4fdd\u8b77\u7db2\u7ad9\u6d41\u91cf\u3002\u6b64\u904e\u7a0b\u900f\u904e SSL \u6191\u8b49\u52a0\u5bc6\u4f3a\u670d\u5668\u8207\u8a2a\u5ba2\u4e4b\u9593\u7684\u8cc7\u6599\u50b3\u8f38\u3002\u8acb\u4f9d\u7167\u4ee5\u4e0b\u6b65\u9a5f\u8a2d\u5b9a\uff1a<\/p>\n<ol>\n<li>\n<p><strong>\u5b89\u88dd Certbot \u4e26\u53d6\u5f97\u514d\u8cbb SSL \u6191\u8b49<\/strong><br \/>Certbot \u53ef\u4ee5\u5354\u52a9\u4f60\u5f9e Let\u2019s Encrypt \u53d6\u5f97\u4e26\u5b89\u88dd SSL \u6191\u8b49\u3002\u57f7\u884c\u4ee5\u4e0b\u6307\u4ee4\uff1a<\/p>\n<pre><code>sudo apt install certbot python3-certbot-nginx\r\nsudo certbot --nginx -d example.com -d www.example.com\r\n<\/code><\/pre>\n<\/li>\n<li>\n<p><strong>\u70ba HTTPS \u914d\u7f6e server \u5340\u584a<\/strong><br \/>\u7de8\u8f2f Nginx \u914d\u7f6e\u6a94\uff0c\u70ba HTTPS \u65b0\u589e\u4e00\u500b server \u5340\u584a\uff1a<\/p>\n<pre><code>server {\r\n    listen 443 ssl http2;\r\n    listen [::]:443 ssl http2;\r\n    server_name example.com www.example.com;\r\n    root \/var\/www\/example.com\/html;\r\n    index index.html;\r\n    ssl_certificate \/etc\/letsencrypt\/live\/example.com\/fullchain.pem;\r\n    ssl_certificate_key \/etc\/letsencrypt\/live\/example.com\/privkey.pem;\r\n    # Additional settings...\r\n}\r\n<\/code><\/pre>\n<\/li>\n<li>\n<p><strong>\u91cd\u65b0\u555f\u52d5 Nginx<\/strong><br \/>\u5132\u5b58\u4fee\u6539\u5f8c\uff0c\u91cd\u65b0\u555f\u52d5 Nginx \u8b93\u914d\u7f6e\u751f\u6548\uff1a<\/p>\n<pre><code>sudo systemctl restart nginx\r\n<\/code><\/pre>\n<\/li>\n<\/ol>\n<blockquote>\n<p>\u63d0\u793a\uff1a\u52d9\u5fc5\u6aa2\u67e5 SSL \u6191\u8b49\u8def\u5f91\u8207\u6a94\u6848\u6b0a\u9650\u3002\u82e5\u8def\u5f91\u6216\u6b0a\u9650\u932f\u8aa4\uff0cNginx \u53ef\u80fd\u7121\u6cd5\u9806\u5229\u555f\u52d5\u3002<\/p>\n<\/blockquote>\n<h3>\u5f9e HTTP \u91cd\u65b0\u5c0e\u5411\u5230 HTTPS<\/h3>\n<p>\u70ba\u78ba\u4fdd\u6240\u6709\u5b58\u53d6\u90fd\u4f7f\u7528\u52a0\u5bc6\u9023\u7dda\uff0c\u4f60\u5fc5\u9808\u5c07 HTTP \u8acb\u6c42\u91cd\u65b0\u5c0e\u5411\u5230 HTTPS\u3002\u9019\u4e00\u6b65\u53ef\u4ee5\u9632\u6b62\u4f7f\u7528\u8005\u900f\u904e\u4e0d\u5b89\u5168\u7684\u9023\u7dda\u5b58\u53d6\u7ad9\u9ede\u3002\u5efa\u8b70\u4f7f\u7528 301 \u91cd\u65b0\u5c0e\u5411\uff0c\u5411\u700f\u89bd\u5668\u5ba3\u544a\u6b64\u8b8a\u66f4\u70ba\u6c38\u4e45\u6027\u3002<\/p>\n<p>\u5728 Nginx \u4e2d\u8a2d\u5b9a\u91cd\u65b0\u5c0e\u5411\u7684\u65b9\u6cd5\u5982\u4e0b\uff1a<\/p>\n<ul>\n<li>\n<p>\u65b0\u589e\u4e00\u500b\u76e3\u807d 80 \u9023\u63a5\u57e0\uff08HTTP\uff09\u7684 server \u5340\u584a\uff0c\u4e26\u56de\u50b3 301 \u91cd\u65b0\u5c0e\u5411\u5230 HTTPS\uff1a<\/p>\n<pre><code>server {\r\n    listen 80;\r\n    server_name example.com www.example.com;\r\n    location \/ {\r\n        return 301 https:\/\/$server_name$request_uri;\r\n    }\r\n}\r\n<\/code><\/pre>\n<\/li>\n<li>\n<p>\u4f60\u4e5f\u53ef\u4ee5\u4f7f\u7528\u4e00\u500b\u9810\u8a2d\u7684 server \u5340\u584a\u4f86\u6514\u622a\u6240\u6709 HTTP \u6d41\u91cf\u4e26\u7d71\u4e00\u91cd\u65b0\u5c0e\u5411\uff1a<\/p>\n<pre><code>server {\r\n    listen 80 default_server;\r\n    server_name _;\r\n    return 301 https:\/\/$host$request_uri;\r\n}\r\n<\/code><\/pre>\n<\/li>\n<\/ul>\n<p>\u4e0a\u8ff0\u914d\u7f6e\u80fd\u78ba\u4fdd\u5230\u4f60\u7ad9\u9ede\u7684\u6bcf\u4e00\u500b\u8acb\u6c42\u6700\u7d42\u90fd\u900f\u904e HTTPS \u5b58\u53d6\u3002301 \u6c38\u4e45\u91cd\u65b0\u5c0e\u5411\u5c0d\u641c\u5c0b\u5f15\u64ce\u6700\u4f73\u5316\uff08SEO\uff09\u53cb\u5584\uff0c\u4e5f\u80fd\u63d0\u5347\u4f7f\u7528\u8005\u4fe1\u4efb\u611f\u3002<\/p>\n<blockquote>\n<p>\u6ce8\u610f\uff1a\u4fee\u6539\u5f8c\u52d9\u5fc5\u6e2c\u8a66 HTTP \u5230 HTTPS \u7684\u91cd\u65b0\u5c0e\u5411\u3002\u53ef\u900f\u904e\u700f\u89bd\u5668\u6216 <code>curl<\/code> \u5de5\u5177\u9a57\u8b49 HTTP \u8acb\u6c42\u662f\u5426\u6536\u5230 301 \u4e26\u8df3\u8f49\u5230\u6b63\u78ba\u7684 HTTPS \u4f4d\u5740\u3002<\/p>\n<\/blockquote>\n<h3>\u5c07\u4ee3\u7406\u8acb\u6c42\u6a19\u982d\u8f49\u9001\u7d66 Apache<\/h3>\n<p>\u7576 Nginx \u4f5c\u70ba\u53cd\u5411\u4ee3\u7406\u6642\uff0c\u5fc5\u9808\u5411 Apache \u8f49\u9001\u95dc\u9375\u8acb\u6c42\u6a19\u982d\u3002\u9019\u4e9b\u6a19\u982d\u8cc7\u8a0a\u5354\u52a9 Apache \u5075\u6e2c\u539f\u59cb\u5354\u5b9a\u3001\u7528\u6236\u7aef IP \u7b49\u7d30\u7bc0\u3002\u82e5\u7f3a\u5931\uff0cApache \u53ef\u80fd\u7121\u6cd5\u5224\u65b7\u8acb\u6c42\u662f\u5426\u6e90\u81ea HTTPS\uff0c\u9032\u800c\u5c0e\u81f4\u91cd\u65b0\u5c0e\u5411\u5faa\u74b0\u6216\u7d00\u9304\u6a94\u932f\u8aa4\u3002<\/p>\n<p>\u5728 Nginx HTTPS \u7684 server \u5340\u584a\u4e2d\u65b0\u589e\u5982\u4e0b\u914d\u7f6e\uff1a<\/p>\n<pre><code>location \/ {\r\n    proxy_pass http:\/\/127.0.0.1:8080;\r\n    proxy_set_header Host $host;\r\n    proxy_set_header X-Real-IP $remote_addr;\r\n    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;\r\n    proxy_set_header X-Forwarded-Proto $scheme;\r\n}\r\n<\/code><\/pre>\n<ul>\n<li>\n<p><code>proxy_set_header X-Real-IP $remote_addr;<\/code> \u5c07\u771f\u5be6\u7528\u6236\u7aef IP \u50b3\u905e\u7d66 Apache\u3002<\/p>\n<\/li>\n<li>\n<p><code>proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;<\/code> \u4fdd\u7559\u4ee3\u7406\u93c8\u4e0a\u7684\u6240\u6709\u7528\u6236\u7aef IP\u3002<\/p>\n<\/li>\n<li>\n<p><code>proxy_set_header X-Forwarded-Proto $scheme;<\/code> \u544a\u8a34 Apache \u539f\u59cb\u8acb\u6c42\u4f7f\u7528\u7684\u662f HTTP \u9084\u662f HTTPS\u3002<\/p>\n<\/li>\n<\/ul>\n<blockquote>\n<p>\u26a0\ufe0f <strong>\u5b89\u5168\u8b66\u793a\uff1a<\/strong><br \/>\u52d9\u5fc5\u4ed4\u7d30\u6aa2\u67e5\u53cd\u5411\u4ee3\u7406\u8acb\u6c42\u6a19\u982d\u914d\u7f6e\u3002\u82e5 <code>proxy_pass<\/code> \u8a2d\u5b9a\u932f\u8aa4\u6216\u7f3a\u5c11\u95dc\u9375\u8acb\u6c42\u6a19\u982d\uff0c\u53ef\u80fd\u6703\u6d29\u9732\u654f\u611f\u8cc7\u8a0a\uff0c\u751a\u81f3\u8b93\u653b\u64ca\u8005\u5b58\u53d6\u672c\u61c9\u53d7\u9650\u7684\u5f8c\u7aef\u670d\u52d9\u3002\u7121\u6548\u7684 HTTP \u8acb\u6c42\u53ef\u80fd\u7e5e\u904e\u5b89\u5168\u7b56\u7565\u4e26\u66b4\u9732\u5f8c\u7aef\u56de\u61c9\uff08\u5305\u542b\u6a5f\u5bc6\u6a19\u982d\u8cc7\u8a0a\uff09\u3002\u8acb\u59a5\u5584\u4fdd\u8b77\u914d\u7f6e\u6a94\uff0c\u5207\u52ff\u76f4\u63a5\u5c0d\u5916\u63d0\u4f9b\u5b58\u53d6\u3002<\/p>\n<\/blockquote>\n<p>\u900f\u904e\u8f49\u9001\u9019\u4e9b\u8acb\u6c42\u6a19\u982d\uff0c\u4f60\u53ef\u4ee5\u5354\u52a9 Apache \u505a\u51fa\u6b63\u78ba\u7684\u91cd\u65b0\u5c0e\u5411\u8207\u7d00\u9304\u6a94\u5224\u65b7\u3002\u9019\u4e00\u6b65\u5c0d\u5be6\u73fe\u7a69\u5b9a\u7684 HTTP \u5230 HTTPS \u91cd\u65b0\u5c0e\u5411\u4ee5\u53ca\u6574\u9ad4\u5b89\u5168\u6027\u81f3\u95dc\u91cd\u8981\u3002<\/p>\n<p><strong>\u5f59\u7e3d\u8868\uff1aNginx \u914d\u7f6e HTTPS \u91cd\u65b0\u5c0e\u5411\u7684\u95dc\u9375\u6b65\u9a5f<\/strong><\/p>\n<div fullwidth=\"\" class=\"qc-default-table-wrapper \">\n<table style=\"min-width: 50px;\">\n<colgroup>\n<col style=\"min-width: 25px;\">\n<col style=\"min-width: 25px;\"><\/colgroup>\n<tbody>\n<tr>\n<th colspan=\"1\" rowspan=\"1\">\n<p>\u6b65\u9a5f<\/p>\n<\/th>\n<th colspan=\"1\" rowspan=\"1\">\n<p>\u76ee\u7684<\/p>\n<\/th>\n<\/tr>\n<tr>\n<td colspan=\"1\" rowspan=\"1\">\n<p>\u555f\u7528 HTTPS<\/p>\n<\/td>\n<td colspan=\"1\" rowspan=\"1\">\n<p>\u52a0\u5bc6\u6d41\u91cf\u4e26\u4fdd\u8b77\u4f7f\u7528\u8005\u8cc7\u6599<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td colspan=\"1\" rowspan=\"1\">\n<p>\u5f9e HTTP \u91cd\u65b0\u5c0e\u5411\u5230 HTTPS<\/p>\n<\/td>\n<td colspan=\"1\" rowspan=\"1\">\n<p>\u5f37\u5236\u6240\u6709\u6d41\u91cf\u4f7f\u7528\u5b89\u5168\u9023\u7dda<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td colspan=\"1\" rowspan=\"1\">\n<p>\u8f49\u9001\u4ee3\u7406\u8acb\u6c42\u6a19\u982d<\/p>\n<\/td>\n<td colspan=\"1\" rowspan=\"1\">\n<p>\u78ba\u4fdd Apache \u6b63\u78ba\u8fa8\u8b58\u5354\u5b9a\u8207\u7528\u6236\u7aef IP<\/p>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<p>\u5b8c\u6210\u4ee5\u4e0a\u914d\u7f6e\u5f8c\uff0c\u4f60\u5c31\u5efa\u7acb\u4e86\u4e00\u5957\u5b89\u5168\u3001\u9ad8\u6548\u4e14\u53ef\u9760\u7684 Web \u670d\u52d9\u67b6\u69cb\uff0c\u4e5f\u80fd\u907f\u514d\u8af8\u5982\u91cd\u65b0\u5c0e\u5411\u5faa\u74b0\u548c\u6df7\u5408\u5167\u5bb9\u7b49\u5e38\u898b\u554f\u984c\u3002\u5728\u6b63\u5f0f\u4e0a\u7dda\u524d\uff0c\u8acb\u52d9\u5fc5\u53cd\u8986\u6aa2\u67e5\u914d\u7f6e\u4e26\u9032\u884c\u5145\u5206\u6e2c\u8a66\u3002<\/p>\n<h2>Apache \u914d\u7f6e\uff1a\u907f\u514d\u91cd\u65b0\u5c0e\u5411\u5faa\u74b0<\/h2>\n<p>\u7576 Apache \u4f4d\u65bc Nginx \u4e4b\u5f8c\u57f7\u884c\u6642\uff0c\u4f60\u5fc5\u9808\u914d\u7f6e Apache \u4ee5\u8b58\u5225\u539f\u59cb\u7528\u6236\u7aef\u8cc7\u8a0a\u4e26\u6b63\u78ba\u8655\u7406\u91cd\u65b0\u5c0e\u5411\u3002\u9019\u6709\u52a9\u65bc\u9632\u6b62\u91cd\u65b0\u5c0e\u5411\u5faa\u74b0\uff0c\u4e26\u78ba\u4fdd\u4efb\u4f55\u5f62\u5f0f\u7684\u91cd\u65b0\u5c0e\u5411\uff08\u5305\u542b 301 \u6c38\u4e45\u91cd\u65b0\u5c0e\u5411\uff09\u90fd\u80fd\u5982\u9810\u671f\u904b\u4f5c\u3002\u540c\u6642\u4e5f\u80fd\u63d0\u5347\u5b89\u5168\u6027\u4e26\u7dad\u6301\u7d00\u9304\u6a94\u7684\u6e96\u78ba\u6027\u3002<\/p>\n<h3>\u5728 Apache \u4e2d\u4fe1\u4efb\u4ee3\u7406\u8acb\u6c42\u6a19\u982d<\/h3>\n<p>Apache \u9810\u8a2d\u4e0d\u6703\u81ea\u52d5\u4fe1\u4efb\u4f86\u81ea Nginx \u7684\u4ee3\u7406\u8acb\u6c42\u6a19\u982d\u3002\u4f60\u9700\u8981\u555f\u7528\u4e26\u914d\u7f6e <code>mod_remoteip<\/code> \u6a21\u7d44\u3002\u6b64\u6a21\u7d44\u5354\u52a9 Apache \u5f9e\u4ee3\u7406\u6a19\u982d\u4e2d\u8b80\u53d6\u771f\u5be6\u7528\u6236\u7aef IP \u8207\u5354\u5b9a\u3002\u82e5\u4e0d\u57f7\u884c\u9019\u4e00\u6b65\uff0cApache \u6703\u8a8d\u70ba\u6240\u6709\u8acb\u6c42\u90fd\u4f86\u81ea\u4ee3\u7406\u4f3a\u670d\u5668\u672c\u8eab\uff0c\u5f9e\u800c\u7834\u58de\u91cd\u65b0\u5c0e\u5411\u908f\u8f2f\uff0c\u4e26\u5f71\u97ff\u5b89\u5168\u7b56\u7565\u3002<\/p>\n<p>\u4f60\u53ef\u4ee5\u900f\u904e\u5728 Apache \u914d\u7f6e\u4e2d\u52a0\u5165\u5982\u4e0b\u5167\u5bb9\u4f86\u555f\u7528\u4e26\u8a2d\u5b9a <code>mod_remoteip<\/code>\uff1a<\/p>\n<pre><code># Enable mod_remoteip\r\nLoadModule remoteip_module modules\/mod_remoteip.so\r\n\r\n# Trust proxy headers from Nginx\r\nRemoteIPHeader X-Forwarded-For\r\nRemoteIPTrustedProxy 127.0.0.1\r\n\r\n# Trust the protocol header\r\nRemoteIPProtocolHeader X-Forwarded-Proto\r\n<\/code><\/pre>\n<ul>\n<li>\n<p><code>mod_remoteip<\/code> \u6a21\u7d44\u6703\u5f9e HTTP \u8acb\u6c42\u6a19\u982d\u4e2d\u64f7\u53d6\u771f\u5be6 IP \u4f4d\u5740\uff0c\u9019\u5c0d\u900f\u904e\u4ee3\u7406\u5b58\u53d6\u7684\u8acb\u6c42\u5c24\u70ba\u91cd\u8981\u3002<\/p>\n<\/li>\n<li>\n<p>\u6b64\u6a21\u7d44\u5167\u5efa\u4e00\u5b9a\u7684\u6aa2\u67e5\u908f\u8f2f\uff0c\u4ee5\u964d\u4f4e IP \u507d\u9020\u98a8\u96aa\uff0c\u5354\u52a9 Apache \u4ee5\u771f\u5be6\u7528\u6236\u7aef IP \u9032\u884c\u5b58\u53d6\u63a7\u5236\u3002<\/p>\n<\/li>\n<li>\n<p>\u555f\u7528\u5f8c\uff0c<code>mod_remoteip<\/code> \u6703\u5c07\u9060\u7aef\u4f4d\u5740\u66ff\u63db\u70ba\u771f\u5be6\u7528\u6236\u7aef IP\uff0c\u4f7f Apache \u80fd\u5920\u6b63\u78ba\u8655\u7406\u8acb\u6c42\u8207\u91cd\u65b0\u5c0e\u5411\u3002<\/p>\n<\/li>\n<\/ul>\n<blockquote>\n<p>\u63d0\u793a\uff1a\u4fee\u6539\u914d\u7f6e\u5f8c\u52d9\u5fc5\u91cd\u65b0\u555f\u52d5 Apache\uff0c\u78ba\u4fdd\u65b0\u8a2d\u5b9a\u751f\u6548\u3002<\/p>\n<\/blockquote>\n<h3>\u4f7f\u7528 ProxyPassReverse \u8655\u7406\u91cd\u65b0\u5c0e\u5411<\/h3>\n<p>\u7576 Apache \u4f5c\u70ba\u5f8c\u7aef\u4f3a\u670d\u5668\u4f7f\u7528\u6642\uff0c\u7d93\u5e38\u6703\u914d\u7f6e\u4e00\u4e9b\u4f3a\u670d\u7aef\u91cd\u65b0\u5c0e\u5411\u908f\u8f2f\u3002<code>ProxyPassReverse<\/code> \u6307\u4ee4\u53ef\u4ee5\u5354\u52a9 Apache \u91cd\u5beb HTTP \u56de\u61c9\u6a19\u982d\u4e2d\u7684 URL\u3002\u9019\u5c0d\u907f\u514d\u91cd\u65b0\u5c0e\u5411\u5faa\u74b0\u4e26\u78ba\u4fdd\u6240\u6709\u91cd\u65b0\u5c0e\u5411\u6307\u5411\u6b63\u78ba\u4f4d\u5740\u81f3\u95dc\u91cd\u8981\u3002<\/p>\n<p>\u4e0b\u9762\u7684\u8868\u683c\u7c21\u8981\u8aaa\u660e\u4e86 <code>ProxyPassReverse<\/code> \u6307\u4ee4\uff1a<\/p>\n<div fullwidth=\"\" class=\"qc-default-table-wrapper \">\n<table style=\"min-width: 50px;\">\n<colgroup>\n<col style=\"min-width: 25px;\">\n<col style=\"min-width: 25px;\"><\/colgroup>\n<tbody>\n<tr>\n<th colspan=\"1\" rowspan=\"1\">\n<p>\u8aaa\u660e<\/p>\n<\/th>\n<th colspan=\"1\" rowspan=\"1\">\n<p>\u7528\u4f86\u8abf\u6574\u4f86\u81ea\u88ab\u53cd\u5411\u4ee3\u7406\u4f3a\u670d\u5668\u7684 HTTP \u56de\u61c9\u6a19\u982d\u4e2d\u7684 URL<\/p>\n<\/th>\n<\/tr>\n<tr>\n<td colspan=\"1\" rowspan=\"1\">\n<p>\u8a9e\u6cd5<\/p>\n<\/td>\n<td colspan=\"1\" rowspan=\"1\">\n<p>ProxyPassReverse [path] url [interpolate]<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td colspan=\"1\" rowspan=\"1\">\n<p>\u9069\u7528\u7bc4\u570d<\/p>\n<\/td>\n<td colspan=\"1\" rowspan=\"1\">\n<p>server config, virtual host, directory<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td colspan=\"1\" rowspan=\"1\">\n<p>\u72c0\u614b<\/p>\n<\/td>\n<td colspan=\"1\" rowspan=\"1\">\n<p>Extension<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td colspan=\"1\" rowspan=\"1\">\n<p>\u6a21\u7d44<\/p>\n<\/td>\n<td colspan=\"1\" rowspan=\"1\">\n<p>mod_proxy<\/p>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<p><code>ProxyPassReverse<\/code> \u6703\u91cd\u5beb\u56de\u61c9\u6a19\u982d\u4e2d\u7684 Location\u3001Content-Location \u548c URI \u7b49\u6b04\u4f4d\u88e1\u7684 URL\u3002\u552f\u6709\u5982\u6b64\uff0cApache \u4f5c\u70ba\u53cd\u5411\u4ee3\u7406\u6642\uff0c\u624d\u80fd\u907f\u514d\u91cd\u65b0\u5c0e\u5411\u5faa\u74b0\uff0c\u540c\u6642\u78ba\u4fdd\u5f8c\u7aef\u8fd4\u56de\u7684\u91cd\u65b0\u5c0e\u5411\u4f4d\u5740\u5c0d\u7528\u6236\u7aef\u4f86\u8aaa\u662f\u6b63\u78ba\u7684\u3002<\/p>\n<p>\u8981\u5728 Apache \u4e2d\u914d\u7f6e\u4e00\u500b\u80fd\u6b63\u5e38\u5de5\u4f5c\u7684\u4f3a\u670d\u7aef\u91cd\u65b0\u5c0e\u5411\u60c5\u5883\uff0c\u53ef\u4f9d\u7167\u4ee5\u4e0b\u6b65\u9a5f\u64cd\u4f5c\uff1a<\/p>\n<ol>\n<li>\n<p>\u900f\u904e <code>ProxyPass \"\/app\/\" \"http:\/\/127.0.0.1:8080\/\"<\/code> \u8a2d\u5b9a\u4ee3\u7406\u3002<\/p>\n<\/li>\n<li>\n<p>\u65b0\u589e <code>ProxyPassReverse \"\/app\/\" \"http:\/\/127.0.0.1:8080\/\"<\/code> \u4f86\u8655\u7406\u91cd\u65b0\u5c0e\u5411\u3002<\/p>\n<\/li>\n<li>\n<p>\u5982\u6b64\u4e00\u4f86\u5373\u53ef\u78ba\u4fdd\u5f8c\u7aef Apache \u7522\u751f\u7684\u4efb\u4f55\u91cd\u65b0\u5c0e\u5411\uff0c\u90fd\u88ab\u6b63\u78ba\u91cd\u5beb\u6210\u7528\u6236\u7aef\u53ef\u898b\u7684 URL\u3002<\/p>\n<\/li>\n<\/ol>\n<blockquote>\n<p>\u6ce8\u610f\uff1a\u5728\u4f7f\u7528 ProxyPass \u6642\uff0c\u52d9\u5fc5\u642d\u914d ProxyPassReverse \u4e00\u8d77\u4f7f\u7528\u3002\u9019\u6a23\u624d\u80fd\u78ba\u4fdd\u91cd\u65b0\u5c0e\u5411\u4f4d\u5740\u7cbe\u6e96\uff0c\u907f\u514d\u8b93\u4f7f\u7528\u8005\u611f\u5230\u56f0\u60d1\u3002<\/p>\n<\/blockquote>\n<h3>Apache HTTPS \u865b\u64ec\u4e3b\u6a5f\u914d\u7f6e\u7bc4\u4f8b<\/h3>\n<p>\u5728 Nginx \u524d\u7f6e\u7684\u60c5\u5883\u4e2d\uff0c\u4f60\u4ecd\u7136\u9700\u8981\u5408\u9069\u7684 Apache VirtualHost \u914d\u7f6e\uff0c\u4f86\u8655\u7406 Nginx \u8f49\u9001\u904e\u4f86\u7684\u8acb\u6c42\u3002\u9019\u53ef\u4ee5\u5354\u52a9 Apache \u5b89\u5168\u5730\u8655\u7406\u8acb\u6c42\uff0c\u4e26\u5728\u5167\u90e8\u6b63\u78ba\u8655\u7406\u5404\u7a2e\u91cd\u65b0\u5c0e\u5411\u3002<\/p>\n<p>\u4e0b\u9762\u662f\u4e00\u500b\u7bc4\u4f8b\u8868\u683c\uff0c\u5c55\u793a\u591a\u7db2\u57df\u914d\u7f6e\u6642\u53ef\u80fd\u6d89\u53ca\u7684\u53c3\u6578\uff1a<\/p>\n<p>\u4e0b\u65b9\u5247\u662f\u5728 Nginx \u4e4b\u5f8c\u57f7\u884c\u7684 Apache \u865b\u64ec\u4e3b\u6a5f\u7bc4\u4f8b\u914d\u7f6e\uff1a<\/p>\n<div fullwidth=\"\" class=\"qc-default-table-wrapper \">\n<table style=\"min-width: 100px;\">\n<colgroup>\n<col style=\"min-width: 25px;\">\n<col style=\"min-width: 25px;\">\n<col style=\"min-width: 25px;\">\n<col style=\"min-width: 25px;\"><\/colgroup>\n<tbody>\n<tr>\n<th colspan=\"1\" rowspan=\"1\">\n<p>\u4f3a\u670d\u5668\u540d\u7a31<\/p>\n<\/th>\n<th colspan=\"1\" rowspan=\"1\">\n<p>\u76e3\u807d\u9023\u63a5\u57e0<\/p>\n<\/th>\n<th colspan=\"1\" rowspan=\"1\">\n<p>SSL \u6191\u8b49\u8def\u5f91<\/p>\n<\/th>\n<th colspan=\"1\" rowspan=\"1\">\n<\/th>\n<\/tr>\n<tr>\n<td colspan=\"1\" rowspan=\"1\">\n<p>test.io<\/p>\n<\/td>\n<td colspan=\"1\" rowspan=\"1\">\n<p>80, 443<\/p>\n<\/td>\n<td colspan=\"1\" rowspan=\"1\">\n<p>\/etc\/letsencrypt\/live\/test.io\/fullchain.pem<\/p>\n<\/td>\n<td colspan=\"1\" rowspan=\"1\">\n<\/td>\n<\/tr>\n<tr>\n<td colspan=\"1\" rowspan=\"1\">\n<p>foobar.net<\/p>\n<\/td>\n<td colspan=\"1\" rowspan=\"1\">\n<p>80, 443<\/p>\n<\/td>\n<td colspan=\"1\" rowspan=\"1\">\n<p>\/etc\/letsencrypt\/live\/foobar.net\/fullchain.pem<\/p>\n<\/td>\n<td colspan=\"1\" rowspan=\"1\">\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<pre><code>&lt;VirtualHost *:80&gt;\r\n    ServerName example.com\r\n    # Redirect all HTTP to HTTPS\r\n    Redirect permanent \/ https:\/\/example.com\/\r\n&lt;\/VirtualHost&gt;\r\n\r\n&lt;VirtualHost *:8080&gt;\r\n    ServerName example.com\r\n    DocumentRoot \/var\/www\/example.com\/html\r\n\r\n    # Trust proxy headers\r\n    RemoteIPHeader X-Forwarded-For\r\n    RemoteIPTrustedProxy 127.0.0.1\r\n    RemoteIPProtocolHeader X-Forwarded-Proto\r\n\r\n    # Proxy settings\r\n    ProxyPreserveHost On\r\n    ProxyPass \/ http:\/\/127.0.0.1:8080\/\r\n    ProxyPassReverse \/ http:\/\/127.0.0.1:8080\/\r\n\r\n    # Logging\r\n    LogFormat \"%a %l %u %t \\\"%r\\\" %&gt;s %b \\\"%{Referer}i\\\" \\\"%{User-Agent}i\\\"\" combined\r\n    CustomLog \/var\/log\/apache2\/access.log combined\r\n&lt;\/VirtualHost&gt;\r\n<\/code><\/pre>\n<p>\u6b64\u914d\u7f6e\u78ba\u4fdd Apache \u4fe1\u4efb\u4f86\u81ea Nginx \u7684\u4ee3\u7406\u6a19\u982d\uff0c\u6b63\u78ba\u8655\u7406\u4f3a\u670d\u7aef\u91cd\u65b0\u5c0e\u5411\u4e26\u91cd\u5beb URL\u3002\u540c\u6642\u4e5f\u5728 80 \u9023\u63a5\u57e0\u4e0a\u914d\u7f6e\u4e86\u4e00\u500b\u5f9e HTTP \u5230 HTTPS \u7684 301 \u6c38\u4e45\u91cd\u65b0\u5c0e\u5411\u3002\u5982\u6b64\u4e00\u4f86\uff0c\u4e0d\u50c5\u63d0\u5347\u6574\u9ad4\u5b89\u5168\u6027\uff0c\u4e5f\u80fd\u6709\u6548\u907f\u514d\u91cd\u65b0\u5c0e\u5411\u5faa\u74b0\uff0c\u8b93\u700f\u89bd\u9ad4\u9a57\u66f4\u52a0\u9806\u66a2\u3002<\/p>\n<blockquote>\n<p>\u26a1 \u4fee\u6539\u914d\u7f6e\u5f8c\u8acb\u52d9\u5fc5\u9032\u884c\u6e2c\u8a66\u3002\u5229\u7528 curl \u6216\u700f\u89bd\u5668\u6aa2\u67e5\u6bcf\u4e00\u6b21\u91cd\u65b0\u5c0e\u5411\u662f\u5426\u6b63\u5e38\uff0c\u4e26\u78ba\u8a8d Apache \u7d00\u9304\u6a94\u4e2d\u8a18\u9304\u7684\u7528\u6236\u7aef IP \u548c\u5354\u5b9a\u662f\u5426\u6e96\u78ba\u3002<\/p>\n<\/blockquote>\n<h2>\u6e2c\u8a66\u8207\u6392\u67e5 HTTP \u5230 HTTPS \u91cd\u65b0\u5c0e\u5411<\/h2>\n<h3>\u9a57\u8b49\u91cd\u65b0\u5c0e\u5411\u8207 SSL \u72c0\u614b<\/h3>\n<p>\u4f60\u9700\u8981\u78ba\u8a8d HTTPS \u90e8\u7f72\u548c\u91cd\u65b0\u5c0e\u5411\u898f\u5247\u662f\u5426\u4f9d\u7167\u9810\u671f\u904b\u4f5c\u3002\u9996\u5148\uff0c\u6aa2\u67e5\u6bcf\u4e00\u500b HTTP \u8acb\u6c42\u662f\u5426\u90fd\u80fd\u6536\u5230 301 \u8df3\u8f49\uff0c\u4e26\u6700\u7d42\u5b58\u53d6 HTTPS \u7248\u672c\u3002\u4f60\u53ef\u4ee5\u900f\u904e\u700f\u89bd\u5668\u958b\u767c\u8005\u5de5\u5177\u6216 <code>curl<\/code> \u6307\u4ee4\u6aa2\u8996\u72c0\u614b\u78bc\uff0c\u78ba\u4fdd\u8df3\u8f49\u6307\u5411\u6b63\u78ba\u7684\u76ee\u6a19\u4f4d\u5740\u3002\u540c\u6642\uff0c\u9084\u8981\u6aa2\u67e5 SSL \u6191\u8b49\u662f\u5426\u6709\u6548\u4e26\u88ab\u4e3b\u6d41\u700f\u89bd\u5668\u4fe1\u4efb\u3002<\/p>\n<p>\u4e0b\u8868\u5217\u51fa\u4e86\u4e00\u4e9b\u5728\u53cd\u5411\u4ee3\u7406\u74b0\u5883\u4e2d\u6e2c\u8a66 SSL \u8207\u91cd\u65b0\u5c0e\u5411\u884c\u70ba\u7684\u6700\u4f73\u5be6\u52d9\uff1a<\/p>\n<div fullwidth=\"\" class=\"qc-default-table-wrapper \">\n<table style=\"min-width: 50px;\">\n<colgroup>\n<col style=\"min-width: 25px;\">\n<col style=\"min-width: 25px;\"><\/colgroup>\n<tbody>\n<tr>\n<th colspan=\"1\" rowspan=\"1\">\n<p>\u6700\u4f73\u5be6\u52d9<\/p>\n<\/th>\n<th colspan=\"1\" rowspan=\"1\">\n<p>\u8aaa\u660e<\/p>\n<\/th>\n<\/tr>\n<tr>\n<td colspan=\"1\" rowspan=\"1\">\n<p>\u53ea\u4f7f\u7528\u901a\u904e FIPS \u8a8d\u8b49\u7684\u52a0\u5bc6\u5957\u4ef6<\/p>\n<\/td>\n<td colspan=\"1\" rowspan=\"1\">\n<p>\u914d\u7f6e\u5b89\u5168\u7684\u52a0\u5bc6\u5957\u4ef6\uff0c\u4ee5\u589e\u5f37\u53cd\u5411\u4ee3\u7406\u60c5\u5883\u4e0b\u7684 SSL \u9023\u7dda\u5f37\u5ea6\u3002<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td colspan=\"1\" rowspan=\"1\">\n<p>\u555f\u7528\u7528\u6236\u7aef\u6191\u8b49\u9a57\u8b49<\/p>\n<\/td>\n<td colspan=\"1\" rowspan=\"1\">\n<p>\u900f\u904e\u9a57\u8b49\u7528\u6236\u7aef\u6191\u8b49\u5be6\u73fe\u96d9\u5411\u9a57\u8b49\uff08Mutual TLS\uff09\u3002<\/p>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<p>\u6b64\u5916\u4f60\u9084\u61c9\uff1a<\/p>\n<ul>\n<li>\n<p>\u76e3\u63a7\u6191\u8b49\u5230\u671f\u6642\u9593\uff0c\u4e26\u5728\u5230\u671f\u524d\u81f3\u5c11 30 \u5929\u8a2d\u5b9a\u8b66\u793a\u3002<\/p>\n<\/li>\n<li>\n<p>\u5728\u6bcf\u6b21\u66f4\u65b0\u6216\u4fee\u6539\u914d\u7f6e\u5f8c\u91cd\u65b0\u6e2c\u8a66\u3002<\/p>\n<\/li>\n<li>\n<p>\u5c07\u6191\u8b49\u7e8c\u671f\u6d41\u7a0b\u81ea\u52d5\u5316\uff0c\u78ba\u4fdd\u6301\u7e8c\u7684\u5b89\u5168\u6027\u3002<\/p>\n<\/li>\n<\/ul>\n<h3>\u4fee\u5fa9\u5e38\u898b\u554f\u984c\uff08\u5faa\u74b0\u91cd\u65b0\u5c0e\u5411\u3001\u6df7\u5408\u5167\u5bb9\uff09<\/h3>\n<p>\u91cd\u65b0\u5c0e\u5411\u5faa\u74b0\u8207\u6df7\u5408\u5167\u5bb9\u932f\u8aa4\u6703\u56b4\u91cd\u5f71\u97ff\u7ad9\u9ede\u53ef\u7528\u6027\u3002\u82e5\u9047\u5230\u6301\u7e8c\u4e0d\u65b7\u7684\u91cd\u65b0\u5c0e\u5411\uff0c\u9996\u5148\u5617\u8a66\u6e05\u9664\u700f\u89bd\u5668 Cookie \u8207\u5feb\u53d6\u3002\u640d\u58de\u6216\u904e\u671f\u7684\u767b\u5165\uff0f\u5de5\u4f5c\u968e\u6bb5 Cookie \u5f80\u5f80\u6703\u89f8\u767c\u9019\u985e\u554f\u984c\u3002\u540c\u6642\uff0c\u4f3a\u670d\u5668\u914d\u7f6e\u932f\u8aa4\u6216\u4e0d\u7576\u7684 HTTPS \u91cd\u65b0\u5c0e\u5411\u898f\u5247\u4e5f\u53ef\u80fd\u9020\u6210\u5faa\u74b0\u3002<\/p>\n<p>\u4f60\u53ef\u4ee5\u4f9d\u7167\u4ee5\u4e0b\u6b65\u9a5f\u6392\u67e5\uff1a<\/p>\n<ol>\n<li>\n<p>\u6e05\u9664\u700f\u89bd\u5668\u8cc7\u6599\uff0c\u79fb\u9664\u904e\u671f Cookie\u3002<\/p>\n<\/li>\n<li>\n<p>\u6aa2\u67e5\u4f3a\u670d\u7aef\u91cd\u65b0\u5c0e\u5411\u898f\u5247\u662f\u5426\u5b58\u5728\u885d\u7a81\u3002<\/p>\n<\/li>\n<li>\n<p>\u4f7f\u7528\u700f\u89bd\u5668\u958b\u767c\u8005\u5de5\u5177\u6aa2\u8996\u7db2\u8def\u8acb\u6c42\uff0c\u5206\u6790\u91cd\u65b0\u5c0e\u5411\u93c8\u8def\u3002<\/p>\n<\/li>\n<li>\n<p>\u6aa2\u67e5\u4f3a\u670d\u5668\u7d00\u9304\u6a94\uff0c\u7559\u610f\u91cd\u8907\u51fa\u73fe\u7684\u91cd\u65b0\u5c0e\u5411\u9805\u76ee\u3002<\/p>\n<\/li>\n<\/ol>\n<p>\u6df7\u5408\u5167\u5bb9\uff08Mixed Content\uff09\u8b66\u793a\u51fa\u73fe\u5728 HTTPS \u9801\u9762\u8f09\u5165\u4e86 HTTP \u8cc7\u6e90\u6642\u3002\u8981\u4fee\u5fa9\u6b64\u554f\u984c\uff0c\u61c9\u5c07\u6240\u6709\u8cc7\u6e90\u9023\u7d50\u66f4\u65b0\u70ba HTTPS\u3002\u67d0\u4e9b\u5916\u639b\u6216\u7b2c\u4e09\u65b9\u670d\u52d9\u4e5f\u53ef\u80fd\u5f15\u767c\u91cd\u65b0\u5c0e\u5411\u6216\u6df7\u5408\u5167\u5bb9\u7570\u5e38\uff0c\u82e5\u554f\u984c\u6301\u7e8c\uff0c\u8acb\u4e00\u4f75\u6392\u67e5\u9019\u4e9b\u5143\u4ef6\u3002<\/p>\n<h3>\u4e0a\u7dda\u524d\u6aa2\u67e5\u6e05\u55ae<\/h3>\n<p>\u5728\u6b63\u5f0f\u5c0d\u5916\u63d0\u4f9b\u670d\u52d9\u4e4b\u524d\uff0c\u53ef\u4ee5\u4f7f\u7528\u4ee5\u4e0b\u6e05\u55ae\u78ba\u4fdd\u90e8\u7f72\u9806\u5229\uff1a<\/p>\n<ul>\n<li>\n<p>\u6e2c\u8a66\u6240\u6709 HTTP \u5230 HTTPS \u7684\u91cd\u65b0\u5c0e\u5411\uff0c\u78ba\u8a8d 301 \u6c38\u4e45\u91cd\u65b0\u5c0e\u5411\u6b63\u5e38\u904b\u4f5c\u3002<\/p>\n<\/li>\n<li>\n<p>\u9a57\u8b49 SSL \u6191\u8b49\u662f\u5426\u6709\u6548\uff0c\u4e26\u5728\u5404\u4e3b\u6d41\u700f\u89bd\u5668\u4e2d\u7121\u5b89\u5168\u8b66\u544a\u3002<\/p>\n<\/li>\n<li>\n<p>\u6aa2\u67e5\u6240\u6709\u4f3a\u670d\u5668\u53ca\u61c9\u7528\u5c64\u91cd\u65b0\u5c0e\u5411\u898f\u5247\uff0c\u907f\u514d\u5f7c\u6b64\u885d\u7a81\u3002<\/p>\n<\/li>\n<li>\n<p>\u76e3\u63a7\u6191\u8b49\u5230\u671f\u6642\u9593\u4e26\u555f\u7528\u81ea\u52d5\u7e8c\u671f\u6a5f\u5236\u3002<\/p>\n<\/li>\n<li>\n<p>\u6aa2\u67e5\u662f\u5426\u5b58\u5728\u6df7\u5408\u5167\u5bb9\uff0c\u78ba\u4fdd\u6240\u6709\u8cc7\u6e90\u900f\u904e HTTPS \u8f09\u5165\u3002<\/p>\n<\/li>\n<li>\n<p>\u5206\u6790\u4f3a\u670d\u5668\u7d00\u9304\u6a94\uff0c\u7559\u610f\u7570\u5e38\u7684\u91cd\u65b0\u5c0e\u5411\u6a21\u5f0f\u3002<\/p>\n<\/li>\n<li>\n<p>\u78ba\u8a8d\u5b89\u5168\u56de\u61c9\u6a19\u982d\u8207\u4ee3\u7406\u8acb\u6c42\u6a19\u982d\u5df2\u6b63\u78ba\u8a2d\u5b9a\u3002<\/p>\n<\/li>\n<\/ul>\n<blockquote>\n<p>\u2705 \u900f\u904e\u7d30\u7dfb\u7684\u6e2c\u8a66\u8207\u6301\u7e8c\u76e3\u63a7\uff0c\u4f60\u53ef\u4ee5\u5728\u78ba\u4fdd\u5b89\u5168\u6027\u7684\u540c\u6642\uff0c\u70ba\u4f7f\u7528\u8005\u63d0\u4f9b\u9806\u66a2\u3001\u53ef\u4fe1\u8cf4\u7684\u700f\u89bd\u9ad4\u9a57\u3002<\/p>\n<\/blockquote>\n<div dividerstyle=\"solid\" size=\"large\" color=\"#D1D1D1\" class=\"qc-divider-wrapper\">\n<div class=\"qc-divider\" style=\"border-top-style: solid; width: 100%; border-top-color: rgb(209, 209, 209);\"><\/div>\n<\/div>\n<p>\u4f60\u53ef\u4ee5\u4f9d\u7167\u4ee5\u4e0b\u6b65\u9a5f\u4fdd\u8b77\u7ad9\u9ede\u5b89\u5168\u4e26\u907f\u514d\u91cd\u65b0\u5c0e\u5411\u5faa\u74b0\uff1a<\/p>\n<ol>\n<li>\n<p>\u4f7f\u7528 <code>sudo apt install certbot python3-certbot-nginx -y<\/code> \u5b89\u88dd Certbot\u3002<\/p>\n<\/li>\n<li>\n<p>\u4f7f\u7528 Certbot \u53d6\u5f97\u514d\u8cbb\u7684 SSL \u6191\u8b49\u3002<\/p>\n<\/li>\n<li>\n<p>\u9a57\u8b49\u7ad9\u9ede\u662f\u5426\u53ef\u4ee5\u900f\u904e HTTPS \u6b63\u5e38\u5b58\u53d6\uff0c\u4e26\u4e14 HTTP \u6703\u81ea\u52d5\u91cd\u65b0\u5c0e\u5411\u5230 HTTPS\u3002<\/p>\n<\/li>\n<li>\n<p>\u8a2d\u5b9a\u6191\u8b49\u81ea\u52d5\u7e8c\u671f\u3002<\/p>\n<\/li>\n<\/ol>\n<p>\u5c07\u91cd\u65b0\u5c0e\u5411\u908f\u8f2f\u96c6\u4e2d\u7531 Nginx \u7ba1\u7406\uff0c\u53ef\u4ee5\u907f\u514d\u591a\u8655\u898f\u5247\u885d\u7a81\uff0c\u5f9e\u800c\u4fdd\u969c\u6d41\u91cf\u5b89\u5168\u3002\u642d\u914d\u4e0a\u65b9\u7684\u6aa2\u67e5\u6e05\u55ae\u8207\u7591\u96e3\u6392\u89e3\u5efa\u8b70\uff0c\u53ef\u4ee5\u5354\u52a9\u4f60\u5b8c\u6210\u4e00\u6b21\u5e73\u7a69\u9806\u66a2\u7684\u4e0a\u7dda\u6d41\u7a0b\u3002<\/p>\n<h2>\u5e38\u898b\u554f\u984c\uff08FAQ\uff09<\/h2>\n<h3>\u4ec0\u9ebc\u662f TLS\uff1f\u5728 Nginx + Apache \u4e2d\u70ba\u4ec0\u9ebc\u9700\u8981\u5b83\uff1f<\/h3>\n<p>TLS \u900f\u904e\u52a0\u5bc6\u4f3a\u670d\u5668\u8207\u8a2a\u5ba2\u4e4b\u9593\u7684\u8cc7\u6599\uff0c\u4fdd\u8b77\u4f60\u7684\u7f51\u7ad9\u5b89\u5168\u3002\u4f7f\u7528 TLS \u53ef\u4ee5\u9632\u6b62\u653b\u64ca\u8005\u7aca\u807d\u6216\u7ac4\u6539\u50b3\u8f38\u5167\u5bb9\u3002Nginx \u548c Apache \u90fd\u652f\u63f4 TLS\uff0c\u4f46\u5728 Nginx \u524d\u7f6e Apache \u7684\u67b6\u69cb\u4e2d\uff0c\u901a\u5e38\u5efa\u8b70\u7531 Nginx \u7d71\u4e00\u8655\u7406 TLS\uff0c\u4ee5\u7372\u5f97\u66f4\u4f73\u6548\u80fd\u8207\u66f4\u7c21\u4fbf\u7684\u6191\u8b49\u7ba1\u7406\u3002<\/p>\n<h3>HSTS \u5982\u4f55\u63d0\u5347\u4f60\u7684 HTTPS \u91cd\u65b0\u5c0e\u5411\u65b9\u6848\uff1f<\/h3>\n<p>HSTS \u6703\u544a\u8a34\u700f\u89bd\u5668\u5728\u5b58\u53d6\u4f60\u7684\u7db2\u7ad9\u6642\u5fc5\u9808\u4f7f\u7528 HTTPS\u3002\u4e00\u65e6\u8a2d\u5b9a\u4e86 HSTS \u56de\u61c9\u6a19\u982d\uff0c\u5373\u4f7f\u4f7f\u7528\u8005\u624b\u52d5\u8f38\u5165 http:\/\/\uff0c\u700f\u89bd\u5668\u4e5f\u6703\u81ea\u52d5\u5347\u7d1a\u70ba HTTPS\u3002HSTS \u8207 TLS \u642d\u914d\u4f7f\u7528\uff0c\u53ef\u4ee5\u9632\u6b62\u964d\u7d1a\u653b\u64ca\u8207\u4e2d\u9593\u4eba\u6514\u622a\uff0c\u9032\u4e00\u6b65\u63d0\u5347\u6574\u9ad4\u5b89\u5168\u6027\u3002<\/p>\n<h3>\u662f\u5426\u9700\u8981\u540c\u6642\u5728 Nginx \u548c Apache \u4e0a\u958b\u555f HSTS\uff1f<\/h3>\n<p>\u5728\u9019\u7a2e\u67b6\u69cb\u4e0b\uff0c\u53ea\u9700\u8981\u5728 Nginx \u4e2d\u8a2d\u5b9a HSTS \u56de\u61c9\u6a19\u982d\u5373\u53ef\u3002\u56e0\u70ba TLS \u7d42\u6b62\u9ede\u5728 Nginx\uff0c\u7531\u5b83\u5c07 HSTS \u6a19\u982d\u50b3\u9001\u7d66\u700f\u89bd\u5668\u5373\u53ef\u3002Apache \u4e0d\u76f4\u63a5\u8655\u7406 TLS \u6642\uff0c\u7121\u9700\u518d\u55ae\u7368\u8a2d\u5b9a HSTS\uff0c\u5f9e\u800c\u7c21\u5316\u6574\u9ad4\u914d\u7f6e\u3002<\/p>\n<h3>\u82e5\u932f\u8aa4\u914d\u7f6e TLS \u6216 HSTS \u6703\u51fa\u73fe\u54ea\u4e9b\u554f\u984c\uff1f<\/h3>\n<p>\u5982\u679c TLS \u6216 HSTS \u914d\u7f6e\u4e0d\u7576\uff0c\u4f7f\u7528\u8005\u53ef\u80fd\u6703\u770b\u5230\u5b89\u5168\u8b66\u544a\uff0c\u6216\u9677\u5165\u91cd\u65b0\u5c0e\u5411\u5faa\u74b0\u3002\u56b4\u91cd\u6642\u9084\u53ef\u80fd\u66b4\u9732\u654f\u611f\u8cc7\u6599\u3002\u6bcf\u6b21\u4fee\u6539 TLS \u6216 HSTS \u914d\u7f6e\u5f8c\uff0c\u90fd\u8981\u9032\u884c\u5145\u5206\u6e2c\u8a66\uff0c\u4e26\u501f\u52a9\u7dda\u4e0a\u5de5\u5177\u6aa2\u67e5 HSTS \u6a19\u982d\u8207 TLS \u914d\u7f6e\u662f\u5426\u5408\u7406\u3002<\/p>\n<h3>\u5982\u4f55\u5728 Nginx \u4e2d\u555f\u7528 HTTP Strict Transport Security\uff1f<\/h3>\n<p>\u4f60\u53ef\u4ee5\u5728 Nginx \u7684 server \u5340\u584a\u4e2d\u65b0\u589e HSTS \u6a19\u982d\uff0c\u5982\uff1a<\/p>\n<pre><code>add_header Strict-Transport-Security \"max-age=31536000; includeSubDomains\" always;\r\n<\/code><\/pre>\n<p>\u5982\u6b64\u4fbf\u555f\u7528\u4e86 HTTP Strict Transport Security\u3002\u5b83\u8207 TLS \u642d\u914d\u4f7f\u7528\uff0c\u5f37\u5236\u700f\u89bd\u5668\u5728\u5b58\u53d6\u4f60\u7684\u4e3b\u7db2\u57df\u548c\u6240\u6709\u5b50\u7db2\u57df\u6642\u90fd\u4f7f\u7528 HTTPS\u3002<\/p>\n<\/p><\/div>\n","protected":false},"excerpt":{"rendered":"<p>\u82e5\u8981\u7372\u5f97\u6700\u53ef\u9760\u7684 HTTPS \u91cd\u65b0\u5c0e\u5411\u6548\u679c\uff0c\u6700\u4f73\u5be6\u52d9\u662f\u8b93 Nginx \u7d71\u4e00\u8655\u7406 HTTPS \u4ee5\u53ca\u6240\u6709 HTTP [&#8230;]<\/p>\n<p><a class=\"btn btn-secondary understrap-read-more-link\" href=\"https:\/\/www.varidata.com\/zh-tw\/blog-tc\/how-to-set-up-https-redirect-with-apache-behind-nginx\/\">Read More&#8230;<\/a><\/p>\n","protected":false},"author":11,"featured_media":30510,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[267],"tags":[],"class_list":["post-30513","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-blog-tc"],"acf":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v26.3 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>\u5728 Nginx \u524d\u7f6e Apache \u6642\u5982\u4f55\u914d\u7f6e HTTPS \u91cd\u65b0\u5c0e\u5411<\/title>\n<meta name=\"description\" content=\"\u900f\u904e\u6b63\u78ba\u914d\u7f6e\u4ee3\u7406\u6a19\u982d\u4e26\u5c07\u91cd\u65b0\u5c0e\u5411\u96c6\u4e2d\u5728 Nginx \u4e2d\uff0c\u5728 Nginx \u524d\u7f6e Apache \u6642\u5be6\u4f5c HTTPS \u91cd\u65b0\u5c0e\u5411\uff0c\u78ba\u4fdd\u6d41\u91cf\u5b89\u5168\u4e14\u4e0d\u7522\u751f\u91cd\u65b0\u5c0e\u5411\u5faa\u74b0\u3002\" \/>\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.varidata.com\/zh-tw\/blog-tc\/how-to-set-up-https-redirect-with-apache-behind-nginx\/\" \/>\n<meta property=\"og:locale\" content=\"zh_TW\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"\u5728 Nginx \u524d\u7f6e Apache \u6642\u5982\u4f55\u914d\u7f6e HTTPS \u91cd\u65b0\u5c0e\u5411\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.varidata.com\/zh-tw\/blog-tc\/how-to-set-up-https-redirect-with-apache-behind-nginx\/\" \/>\n<meta property=\"og:site_name\" content=\"Varidata Limited\" \/>\n<meta property=\"article:published_time\" content=\"2026-03-03T08:22:06+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2026-03-03T08:24:01+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.varidata.com\/wp-content\/uploads\/2026\/03\/\u5c4f\u5e55\u622a\u56fe-2026-03-03-161625-1.png\" \/>\n\t<meta property=\"og:image:width\" content=\"681\" \/>\n\t<meta property=\"og:image:height\" content=\"371\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/www.varidata.com\/zh-tw\/blog-tc\/how-to-set-up-https-redirect-with-apache-behind-nginx\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/www.varidata.com\/zh-tw\/blog-tc\/how-to-set-up-https-redirect-with-apache-behind-nginx\/\"},\"author\":\"Varidata\",\"headline\":\"\u5728 Nginx \u524d\u7f6e Apache \u6642\u5982\u4f55\u914d\u7f6e HTTPS \u91cd\u65b0\u5c0e\u5411\",\"datePublished\":\"2026-03-03T08:22:06+00:00\",\"dateModified\":\"2026-03-03T08:24:01+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/www.varidata.com\/zh-tw\/blog-tc\/how-to-set-up-https-redirect-with-apache-behind-nginx\/\"},\"wordCount\":357,\"publisher\":{\"@id\":\"https:\/\/www.varidata.com\/zh-tw\/#organization\"},\"image\":{\"@id\":\"https:\/\/www.varidata.com\/zh-tw\/blog-tc\/how-to-set-up-https-redirect-with-apache-behind-nginx\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.varidata.com\/wp-content\/uploads\/2026\/03\/\u5c4f\u5e55\u622a\u56fe-2026-03-03-161625-1.png\",\"articleSection\":[\"Varidata \u5b98\u65b9\u535a\u5ba2\"],\"inLanguage\":\"zh-TW\"},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.varidata.com\/zh-tw\/blog-tc\/how-to-set-up-https-redirect-with-apache-behind-nginx\/\",\"url\":\"https:\/\/www.varidata.com\/zh-tw\/blog-tc\/how-to-set-up-https-redirect-with-apache-behind-nginx\/\",\"name\":\"\u5728 Nginx \u524d\u7f6e Apache \u6642\u5982\u4f55\u914d\u7f6e HTTPS \u91cd\u65b0\u5c0e\u5411\",\"isPartOf\":{\"@id\":\"https:\/\/www.varidata.com\/zh-tw\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/www.varidata.com\/zh-tw\/blog-tc\/how-to-set-up-https-redirect-with-apache-behind-nginx\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/www.varidata.com\/zh-tw\/blog-tc\/how-to-set-up-https-redirect-with-apache-behind-nginx\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.varidata.com\/wp-content\/uploads\/2026\/03\/\u5c4f\u5e55\u622a\u56fe-2026-03-03-161625-1.png\",\"datePublished\":\"2026-03-03T08:22:06+00:00\",\"dateModified\":\"2026-03-03T08:24:01+00:00\",\"description\":\"\u900f\u904e\u6b63\u78ba\u914d\u7f6e\u4ee3\u7406\u6a19\u982d\u4e26\u5c07\u91cd\u65b0\u5c0e\u5411\u96c6\u4e2d\u5728 Nginx \u4e2d\uff0c\u5728 Nginx \u524d\u7f6e Apache \u6642\u5be6\u4f5c HTTPS \u91cd\u65b0\u5c0e\u5411\uff0c\u78ba\u4fdd\u6d41\u91cf\u5b89\u5168\u4e14\u4e0d\u7522\u751f\u91cd\u65b0\u5c0e\u5411\u5faa\u74b0\u3002\",\"breadcrumb\":{\"@id\":\"https:\/\/www.varidata.com\/zh-tw\/blog-tc\/how-to-set-up-https-redirect-with-apache-behind-nginx\/#breadcrumb\"},\"inLanguage\":\"zh-TW\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.varidata.com\/zh-tw\/blog-tc\/how-to-set-up-https-redirect-with-apache-behind-nginx\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"zh-TW\",\"@id\":\"https:\/\/www.varidata.com\/zh-tw\/blog-tc\/how-to-set-up-https-redirect-with-apache-behind-nginx\/#primaryimage\",\"url\":\"https:\/\/www.varidata.com\/wp-content\/uploads\/2026\/03\/\u5c4f\u5e55\u622a\u56fe-2026-03-03-161625-1.png\",\"contentUrl\":\"https:\/\/www.varidata.com\/wp-content\/uploads\/2026\/03\/\u5c4f\u5e55\u622a\u56fe-2026-03-03-161625-1.png\",\"width\":681,\"height\":371,\"caption\":\"Nginx \u524d\u7f6e Apache \u7684 HTTPS \u91cd\u65b0\u5c0e\u5411\u793a\u610f\u5716\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.varidata.com\/zh-tw\/blog-tc\/how-to-set-up-https-redirect-with-apache-behind-nginx\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.varidata.com\/zh-tw\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"\u5728 Nginx \u524d\u7f6e Apache \u6642\u5982\u4f55\u914d\u7f6e HTTPS \u91cd\u65b0\u5c0e\u5411\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.varidata.com\/zh-tw\/#website\",\"url\":\"https:\/\/www.varidata.com\/zh-tw\/\",\"name\":\"Varidata Limited\",\"description\":\"\",\"publisher\":{\"@id\":\"https:\/\/www.varidata.com\/zh-tw\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.varidata.com\/zh-tw\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"zh-TW\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/www.varidata.com\/zh-tw\/#organization\",\"name\":\"Varidata\",\"url\":\"https:\/\/www.varidata.com\/zh-tw\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"zh-TW\",\"@id\":\"https:\/\/www.varidata.com\/zh-tw\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/www.varidata.com\/wp-content\/uploads\/2021\/09\/varidata_logo_white_-748x480_hor_web-1.png\",\"contentUrl\":\"https:\/\/www.varidata.com\/wp-content\/uploads\/2021\/09\/varidata_logo_white_-748x480_hor_web-1.png\",\"width\":248,\"height\":94,\"caption\":\"Varidata\"},\"image\":{\"@id\":\"https:\/\/www.varidata.com\/zh-tw\/#\/schema\/logo\/image\/\"}},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.varidata.com\/zh-tw\/#\/schema\/person\/afeb2203681f7919a757a02690f38abd\",\"name\":\"Daisy Yu\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"zh-TW\",\"@id\":\"https:\/\/www.varidata.com\/zh-tw\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/38db59364245f7a04c07a2888056fc3db37247c1af72457af92d8001da594989?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/38db59364245f7a04c07a2888056fc3db37247c1af72457af92d8001da594989?s=96&d=mm&r=g\",\"caption\":\"Daisy Yu\"}}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"\u5728 Nginx \u524d\u7f6e Apache \u6642\u5982\u4f55\u914d\u7f6e HTTPS \u91cd\u65b0\u5c0e\u5411","description":"\u900f\u904e\u6b63\u78ba\u914d\u7f6e\u4ee3\u7406\u6a19\u982d\u4e26\u5c07\u91cd\u65b0\u5c0e\u5411\u96c6\u4e2d\u5728 Nginx \u4e2d\uff0c\u5728 Nginx \u524d\u7f6e Apache \u6642\u5be6\u4f5c HTTPS \u91cd\u65b0\u5c0e\u5411\uff0c\u78ba\u4fdd\u6d41\u91cf\u5b89\u5168\u4e14\u4e0d\u7522\u751f\u91cd\u65b0\u5c0e\u5411\u5faa\u74b0\u3002","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.varidata.com\/zh-tw\/blog-tc\/how-to-set-up-https-redirect-with-apache-behind-nginx\/","og_locale":"zh_TW","og_type":"article","og_title":"\u5728 Nginx \u524d\u7f6e Apache \u6642\u5982\u4f55\u914d\u7f6e HTTPS \u91cd\u65b0\u5c0e\u5411","og_url":"https:\/\/www.varidata.com\/zh-tw\/blog-tc\/how-to-set-up-https-redirect-with-apache-behind-nginx\/","og_site_name":"Varidata Limited","article_published_time":"2026-03-03T08:22:06+00:00","article_modified_time":"2026-03-03T08:24:01+00:00","og_image":[{"width":681,"height":371,"url":"https:\/\/www.varidata.com\/wp-content\/uploads\/2026\/03\/\u5c4f\u5e55\u622a\u56fe-2026-03-03-161625-1.png","type":"image\/png"}],"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.varidata.com\/zh-tw\/blog-tc\/how-to-set-up-https-redirect-with-apache-behind-nginx\/#article","isPartOf":{"@id":"https:\/\/www.varidata.com\/zh-tw\/blog-tc\/how-to-set-up-https-redirect-with-apache-behind-nginx\/"},"author":"Varidata","headline":"\u5728 Nginx \u524d\u7f6e Apache \u6642\u5982\u4f55\u914d\u7f6e HTTPS \u91cd\u65b0\u5c0e\u5411","datePublished":"2026-03-03T08:22:06+00:00","dateModified":"2026-03-03T08:24:01+00:00","mainEntityOfPage":{"@id":"https:\/\/www.varidata.com\/zh-tw\/blog-tc\/how-to-set-up-https-redirect-with-apache-behind-nginx\/"},"wordCount":357,"publisher":{"@id":"https:\/\/www.varidata.com\/zh-tw\/#organization"},"image":{"@id":"https:\/\/www.varidata.com\/zh-tw\/blog-tc\/how-to-set-up-https-redirect-with-apache-behind-nginx\/#primaryimage"},"thumbnailUrl":"https:\/\/www.varidata.com\/wp-content\/uploads\/2026\/03\/\u5c4f\u5e55\u622a\u56fe-2026-03-03-161625-1.png","articleSection":["Varidata \u5b98\u65b9\u535a\u5ba2"],"inLanguage":"zh-TW"},{"@type":"WebPage","@id":"https:\/\/www.varidata.com\/zh-tw\/blog-tc\/how-to-set-up-https-redirect-with-apache-behind-nginx\/","url":"https:\/\/www.varidata.com\/zh-tw\/blog-tc\/how-to-set-up-https-redirect-with-apache-behind-nginx\/","name":"\u5728 Nginx \u524d\u7f6e Apache \u6642\u5982\u4f55\u914d\u7f6e HTTPS \u91cd\u65b0\u5c0e\u5411","isPartOf":{"@id":"https:\/\/www.varidata.com\/zh-tw\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.varidata.com\/zh-tw\/blog-tc\/how-to-set-up-https-redirect-with-apache-behind-nginx\/#primaryimage"},"image":{"@id":"https:\/\/www.varidata.com\/zh-tw\/blog-tc\/how-to-set-up-https-redirect-with-apache-behind-nginx\/#primaryimage"},"thumbnailUrl":"https:\/\/www.varidata.com\/wp-content\/uploads\/2026\/03\/\u5c4f\u5e55\u622a\u56fe-2026-03-03-161625-1.png","datePublished":"2026-03-03T08:22:06+00:00","dateModified":"2026-03-03T08:24:01+00:00","description":"\u900f\u904e\u6b63\u78ba\u914d\u7f6e\u4ee3\u7406\u6a19\u982d\u4e26\u5c07\u91cd\u65b0\u5c0e\u5411\u96c6\u4e2d\u5728 Nginx \u4e2d\uff0c\u5728 Nginx \u524d\u7f6e Apache \u6642\u5be6\u4f5c HTTPS \u91cd\u65b0\u5c0e\u5411\uff0c\u78ba\u4fdd\u6d41\u91cf\u5b89\u5168\u4e14\u4e0d\u7522\u751f\u91cd\u65b0\u5c0e\u5411\u5faa\u74b0\u3002","breadcrumb":{"@id":"https:\/\/www.varidata.com\/zh-tw\/blog-tc\/how-to-set-up-https-redirect-with-apache-behind-nginx\/#breadcrumb"},"inLanguage":"zh-TW","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.varidata.com\/zh-tw\/blog-tc\/how-to-set-up-https-redirect-with-apache-behind-nginx\/"]}]},{"@type":"ImageObject","inLanguage":"zh-TW","@id":"https:\/\/www.varidata.com\/zh-tw\/blog-tc\/how-to-set-up-https-redirect-with-apache-behind-nginx\/#primaryimage","url":"https:\/\/www.varidata.com\/wp-content\/uploads\/2026\/03\/\u5c4f\u5e55\u622a\u56fe-2026-03-03-161625-1.png","contentUrl":"https:\/\/www.varidata.com\/wp-content\/uploads\/2026\/03\/\u5c4f\u5e55\u622a\u56fe-2026-03-03-161625-1.png","width":681,"height":371,"caption":"Nginx \u524d\u7f6e Apache \u7684 HTTPS \u91cd\u65b0\u5c0e\u5411\u793a\u610f\u5716"},{"@type":"BreadcrumbList","@id":"https:\/\/www.varidata.com\/zh-tw\/blog-tc\/how-to-set-up-https-redirect-with-apache-behind-nginx\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.varidata.com\/zh-tw\/"},{"@type":"ListItem","position":2,"name":"\u5728 Nginx \u524d\u7f6e Apache \u6642\u5982\u4f55\u914d\u7f6e HTTPS \u91cd\u65b0\u5c0e\u5411"}]},{"@type":"WebSite","@id":"https:\/\/www.varidata.com\/zh-tw\/#website","url":"https:\/\/www.varidata.com\/zh-tw\/","name":"Varidata Limited","description":"","publisher":{"@id":"https:\/\/www.varidata.com\/zh-tw\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.varidata.com\/zh-tw\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"zh-TW"},{"@type":"Organization","@id":"https:\/\/www.varidata.com\/zh-tw\/#organization","name":"Varidata","url":"https:\/\/www.varidata.com\/zh-tw\/","logo":{"@type":"ImageObject","inLanguage":"zh-TW","@id":"https:\/\/www.varidata.com\/zh-tw\/#\/schema\/logo\/image\/","url":"https:\/\/www.varidata.com\/wp-content\/uploads\/2021\/09\/varidata_logo_white_-748x480_hor_web-1.png","contentUrl":"https:\/\/www.varidata.com\/wp-content\/uploads\/2021\/09\/varidata_logo_white_-748x480_hor_web-1.png","width":248,"height":94,"caption":"Varidata"},"image":{"@id":"https:\/\/www.varidata.com\/zh-tw\/#\/schema\/logo\/image\/"}},{"@type":"Person","@id":"https:\/\/www.varidata.com\/zh-tw\/#\/schema\/person\/afeb2203681f7919a757a02690f38abd","name":"Daisy Yu","image":{"@type":"ImageObject","inLanguage":"zh-TW","@id":"https:\/\/www.varidata.com\/zh-tw\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/38db59364245f7a04c07a2888056fc3db37247c1af72457af92d8001da594989?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/38db59364245f7a04c07a2888056fc3db37247c1af72457af92d8001da594989?s=96&d=mm&r=g","caption":"Daisy Yu"}}]}},"_links":{"self":[{"href":"https:\/\/www.varidata.com\/zh-tw\/wp-json\/wp\/v2\/posts\/30513","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.varidata.com\/zh-tw\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.varidata.com\/zh-tw\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.varidata.com\/zh-tw\/wp-json\/wp\/v2\/users\/11"}],"replies":[{"embeddable":true,"href":"https:\/\/www.varidata.com\/zh-tw\/wp-json\/wp\/v2\/comments?post=30513"}],"version-history":[{"count":2,"href":"https:\/\/www.varidata.com\/zh-tw\/wp-json\/wp\/v2\/posts\/30513\/revisions"}],"predecessor-version":[{"id":30515,"href":"https:\/\/www.varidata.com\/zh-tw\/wp-json\/wp\/v2\/posts\/30513\/revisions\/30515"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.varidata.com\/zh-tw\/wp-json\/wp\/v2\/media\/30510"}],"wp:attachment":[{"href":"https:\/\/www.varidata.com\/zh-tw\/wp-json\/wp\/v2\/media?parent=30513"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.varidata.com\/zh-tw\/wp-json\/wp\/v2\/categories?post=30513"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.varidata.com\/zh-tw\/wp-json\/wp\/v2\/tags?post=30513"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}