{"id":99,"date":"2023-04-14T09:02:09","date_gmt":"2023-06-04T16:21:35","guid":{"rendered":"https:\/\/www.silicloud.com\/zh\/blog\/index.php\/2023\/11\/30\/%e5%a6%82%e4%bd%95%e5%9c%a8ubuntu-22-04%e4%b8%8a%e4%bd%bf%e7%94%a8docker%e5%92%8cnginx%e9%83%a8%e7%bd%b2go-web%e5%ba%94%e7%94%a8%e7%a8%8b%e5%ba%8f%e3%80%82\/"},"modified":"2025-07-31T22:53:02","modified_gmt":"2025-07-31T14:53:02","slug":"%e5%a6%82%e4%bd%95%e5%9c%a8ubuntu-22-04%e4%b8%8a%e4%bd%bf%e7%94%a8docker%e5%92%8cnginx%e9%83%a8%e7%bd%b2go-web%e5%ba%94%e7%94%a8%e7%a8%8b%e5%ba%8f%e3%80%82","status":"publish","type":"post","link":"https:\/\/www.silicloud.com\/zh\/blog\/%e5%a6%82%e4%bd%95%e5%9c%a8ubuntu-22-04%e4%b8%8a%e4%bd%bf%e7%94%a8docker%e5%92%8cnginx%e9%83%a8%e7%bd%b2go-web%e5%ba%94%e7%94%a8%e7%a8%8b%e5%ba%8f%e3%80%82\/","title":{"rendered":"Ubuntu 22.04\u4e0a\u4f7f\u7528Docker\u548cNginx\u90e8\u7f72Go Web\u5e94\u7528\uff1a\u5b8c\u6574\u6307\u5357"},"content":{"rendered":"<h3>\u7b80\u4ecb<\/h3>\n<p>Docker\u662f\u4e00\u79cd\u6d41\u884c\u7684\u5bb9\u5668\u5316\u8f6f\u4ef6\uff0c\u5b83\u4f7f\u5f00\u53d1\u4eba\u5458\u80fd\u591f\u8f7b\u677e\u6253\u5305\u5e94\u7528\u7a0b\u5e8f\u53ca\u5176\u8fd0\u884c\u73af\u5883\uff0c\u4ece\u800c\u5b9e\u73b0\u66f4\u5feb\u7684\u8fed\u4ee3\u5468\u671f\u548c\u66f4\u9ad8\u7684\u8d44\u6e90\u5229\u7528\u6548\u7387\uff0c\u540c\u65f6\u786e\u4fdd\u6bcf\u6b21\u8fd0\u884c\u90fd\u80fd\u63d0\u4f9b\u4e00\u81f4\u7684\u9884\u671f\u73af\u5883\u3002Docker Compose\u5219\u662f\u4e00\u6b3e\u5f3a\u5927\u7684\u5bb9\u5668\u7f16\u6392\u5de5\u5177\uff0c\u4e13\u4e3a\u6ee1\u8db3\u73b0\u4ee3\u5e94\u7528\u7a0b\u5e8f\u7684\u9700\u6c42\u800c\u8bbe\u8ba1\uff0c\u5b83\u5141\u8bb8\u540c\u65f6\u8fd0\u884c\u591a\u4e2a\u76f8\u4e92\u8fde\u63a5\u7684\u5bb9\u5668\u3002\u4e0e\u624b\u52a8\u542f\u52a8\u5bb9\u5668\u4e0d\u540c\uff0c\u5bb9\u5668\u7f16\u6392\u5de5\u5177\u8d4b\u4e88\u5f00\u53d1\u4eba\u5458\u540c\u65f6\u63a7\u5236\u3001\u6269\u5c55\u548c\u7ba1\u7406\u5bb9\u5668\u7684\u80fd\u529b\u3002<\/p>\n<p>\u9009\u62e9Nginx\u4f5c\u4e3a\u524d\u7aefWeb\u670d\u52a1\u5668\u5177\u6709\u663e\u8457\u4f18\u52bf\uff0c\u5305\u62ec\u5353\u8d8a\u7684\u6027\u80fd\u3001\u7075\u6d3b\u7684\u914d\u7f6e\u80fd\u529b\u4ee5\u53ca\u5f3a\u5927\u7684TLS\u7ec8\u6b62\u529f\u80fd\u3002\u8fd9\u4e9b\u7279\u6027\u80fd\u591f\u6709\u6548\u51cf\u8f7b\u5e94\u7528\u7a0b\u5e8f\u5728\u5904\u7406\u8fd9\u4e9b\u4efb\u52a1\u4e0a\u7684\u8d1f\u62c5\u3002\u800cnginx-proxy\u662f\u4e00\u4e2a\u81ea\u52a8\u5316\u7684Docker\u5bb9\u5668\u7cfb\u7edf\uff0c\u5b83\u6781\u5927\u5730\u7b80\u5316\u4e86\u5c06Nginx\u914d\u7f6e\u4e3a\u53cd\u5411\u4ee3\u7406\u7684\u8fc7\u7a0b\u3002\u5176Let&#8217;s Encrypt\u63d2\u4ef6\u53ef\u4ee5\u4e0enginx-proxy\u65e0\u7f1d\u534f\u4f5c\uff0c\u81ea\u52a8\u4e3a\u4ee3\u7406\u5bb9\u5668\u751f\u6210\u5e76\u66f4\u65b0SSL\u8bc1\u4e66\u3002<\/p>\n<p>\u5728\u672c\u6559\u7a0b\u4e2d\uff0c\u60a8\u5c06\u5b66\u4e60\u5982\u4f55\u5728\u4e00\u4e2a\u7531Docker Compose\u7f16\u6392\u7684Docker\u5bb9\u5668\u73af\u5883\u4e2d\u90e8\u7f72\u4e00\u4e2a\u793a\u4f8bGo Web\u5e94\u7528\u7a0b\u5e8f\u3002\u8be5\u5e94\u7528\u7a0b\u5e8f\u5c06\u4f7f\u7528gorilla\/mux\u4f5c\u4e3a\u8bf7\u6c42\u8def\u7531\u5668\uff0c\u5e76\u4ee5Nginx\u4f5c\u4e3aWeb\u670d\u52a1\u5668\u3002\u60a8\u8fd8\u5c06\u5229\u7528\u5e26\u6709Let&#8217;s Encrypt\u63d2\u4ef6\u7684nginx-proxy\u4f5c\u4e3a\u53cd\u5411\u4ee3\u7406\u3002\u5b8c\u6210\u672c\u6559\u7a0b\u540e\uff0c\u60a8\u5c06\u80fd\u591f\u4f7f\u7528Docker\u90e8\u7f72\u4e00\u4e2a\u5177\u6709\u591a\u4e2a\u8def\u7531\u7684Go Web\u5e94\u7528\u7a0b\u5e8f\uff0c\u8be5\u5e94\u7528\u7a0b\u5e8f\u53ef\u901a\u8fc7\u60a8\u7684\u57df\u540d\u8bbf\u95ee\uff0c\u5e76\u7531Let&#8217;s Encrypt\u8bc1\u4e66\u63d0\u4f9b\u5b89\u5168\u4fdd\u62a4\u3002<\/p>\n<h2>\u5148\u51b3\u6761\u4ef6<\/h2>\n<ul class=\"post-ul\">\n<li>\u4e00\u53f0\u62e5\u6709root\u6743\u9650\u548c\u8f85\u52a9\u975eroot\u8d26\u6237\u7684Ubuntu 22.04\u670d\u52a1\u5668\u3002\u60a8\u53ef\u4ee5\u6309\u7167<a href=\"#\">\u6b64\u521d\u59cb\u670d\u52a1\u5668\u8bbe\u7f6e\u6307\u5357<\/a>\u8fdb\u884c\u914d\u7f6e\u3002\u672c\u6559\u7a0b\u4e2d\uff0c\u975eroot\u7528\u6237\u540d\u4e3a\u201cjames\u201d\u3002<\/li>\n<li>\u5df2\u5b89\u88c5Docker\uff0c\u8bf7\u53c2\u8003<a href=\"#\">\u5982\u4f55\u5728Ubuntu 22.04\u4e0a\u5b89\u88c5Docker<\/a>\u7684\u524d\u4e24\u4e2a\u6b65\u9aa4\u8fdb\u884c\u64cd\u4f5c\u3002<\/li>\n<li>\u5df2\u5b89\u88c5Docker Compose\uff0c\u8bf7\u53c2\u8003<a href=\"#\">\u5982\u4f55\u5728Ubuntu 22.04\u4e0a\u5b89\u88c5Docker Compose<\/a>\u7684\u7b2c\u4e00\u6b65\u8fdb\u884c\u64cd\u4f5c\u3002<\/li>\n<li>\u4e00\u4e2a\u5df2\u5b8c\u5168\u6ce8\u518c\u7684\u57df\u540d\u3002\u672c\u6559\u7a0b\u5c06\u5168\u7a0b\u4f7f\u7528\u201cyour_domain\u201d\u4f5c\u4e3a\u793a\u4f8b\u3002\u60a8\u53ef\u4ee5\u4ece<a href=\"#\">Freenom<\/a>\u514d\u8d39\u83b7\u53d6\uff0c\u6216\u4f7f\u7528\u60a8\u9009\u62e9\u7684\u4efb\u4f55\u57df\u540d\u6ce8\u518c\u5546\u3002<\/li>\n<li>\u4e00\u4e2a\u6307\u5411\u60a8\u670d\u52a1\u5668\u516c\u5171IP\u5730\u5740\u7684DNS\u201cA\u201d\u8bb0\u5f55\uff0c\u5176\u540d\u79f0\u4e3a\u201cyour_domain\u201d\u3002\u60a8\u53ef\u4ee5\u53c2\u8003<a href=\"#\">Silicon Cloud DNS\u7b80\u4ecb<\/a>\u4e86\u89e3\u5982\u4f55\u6dfb\u52a0\u3002<\/li>\n<li>\u5bf9Docker\u53ca\u5176\u67b6\u6784\u6709\u57fa\u672c\u4e86\u89e3\u3002\u5982\u9700Docker\u5165\u95e8\uff0c\u8bf7\u53c2\u9605<a href=\"#\">Docker\u751f\u6001\u7cfb\u7edf\uff1a\u5e38\u89c1\u7ec4\u4ef6\u4ecb\u7ecd<\/a>\u3002<\/li>\n<\/ul>\n<h2>\u7b2c\u4e00\u6b65\uff1a\u521b\u5efa\u4e00\u4e2a\u793a\u4f8bGo Web\u5e94\u7528\u7a0b\u5e8f<\/h2>\n<p>\u5728\u8fd9\u4e00\u6b65\u4e2d\uff0c\u60a8\u5c06\u8bbe\u7f6e\u5de5\u4f5c\u7a7a\u95f4\u5e76\u521b\u5efa\u4e00\u4e2a\u7b80\u5355\u7684Go Web\u5e94\u7528\u7a0b\u5e8f\uff0c\u7a0d\u540e\u5c06\u5bf9\u5176\u8fdb\u884c\u5bb9\u5668\u5316\u3002\u8be5Go\u5e94\u7528\u7a0b\u5e8f\u5c06\u4f7f\u7528\u529f\u80fd\u5f3a\u5927\u7684gorilla\/mux\u8bf7\u6c42\u8def\u7531\u5668\uff0c\u9009\u62e9\u5b83\u662f\u56e0\u4e3a\u5176\u7075\u6d3b\u6027\u548c\u901f\u5ea6\u3002<\/p>\n<p>\u672c\u6559\u7a0b\u4e2d\uff0c\u6240\u6709\u6570\u636e\u5c06\u5b58\u50a8\u5728<code>~\/go-docker<\/code>\u6587\u4ef6\u5939\u4e0b\u3002\u8bf7\u8fd0\u884c\u4ee5\u4e0b\u547d\u4ee4\u521b\u5efa\u8be5\u6587\u4ef6\u5939\uff1a<\/p>\n<pre class=\"post-pre\"><code><ol><li data-prefix=\"$\"><span class=\"token function\">mkdir<\/span> ~\/go-docker<\/li><\/ol><\/code><\/pre>\n<p>\u7136\u540e\u8fdb\u5165\u8be5\u76ee\u5f55\uff1a<\/p>\n<pre class=\"post-pre\"><code><ol><li data-prefix=\"$\"><span class=\"token builtin class-name\">cd<\/span> ~\/go-docker<\/li><\/ol><\/code><\/pre>\n<p>\u60a8\u5c06\u628a\u793a\u4f8bGo Web\u5e94\u7528\u7a0b\u5e8f\u5b58\u50a8\u5728\u540d\u4e3a<code>main.go<\/code>\u7684\u6587\u4ef6\u4e2d\u3002\u8bf7\u4f7f\u7528\u60a8\u7684\u6587\u672c\u7f16\u8f91\u5668\u521b\u5efa\u5b83\uff1a<\/p>\n<pre class=\"post-pre\"><code><ol><li data-prefix=\"$\"><span class=\"token function\">nano<\/span> main.go<\/li><\/ol><\/code><\/pre>\n<p>\u6dfb\u52a0\u4ee5\u4e0b\u5185\u5bb9\uff1a<\/p>\n<p>\u8fd9\u662f\u6587\u7ae0\u300a\u5982\u4f55\u5728Ubuntu 22.04\u4e0a\u4f7f\u7528Docker\u548cNginx\u90e8\u7f72Go Web\u5e94\u7528\u7a0b\u5e8f\u300b\u7684\u7b2c2\u90e8\u5206\uff08\u51714\u90e8\u5206\uff09\u3002<\/p>\n<pre class=\"post-pre\"><code><span class=\"token keyword\">package<\/span> main\r\n\r\n<span class=\"token keyword\">import<\/span> <span class=\"token punctuation\">(<\/span>\r\n\t<span class=\"token string\">\"fmt\"<\/span>\r\n\t<span class=\"token string\">\"net\/http\"<\/span>\r\n\r\n\t<span class=\"token string\">\"github.com\/gorilla\/mux\"<\/span>\r\n<span class=\"token punctuation\">)<\/span>\r\n\r\n<span class=\"token keyword\">func<\/span> <span class=\"token function\">main<\/span><span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">)<\/span> <span class=\"token punctuation\">{<\/span>\r\n\tr <span class=\"token operator\">:=<\/span> mux<span class=\"token punctuation\">.<\/span><span class=\"token function\">NewRouter<\/span><span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">)<\/span>\r\n\r\n\tr<span class=\"token punctuation\">.<\/span><span class=\"token function\">HandleFunc<\/span><span class=\"token punctuation\">(<\/span><span class=\"token string\">\"\/\"<\/span><span class=\"token punctuation\">,<\/span> <span class=\"token keyword\">func<\/span><span class=\"token punctuation\">(<\/span>w http<span class=\"token punctuation\">.<\/span>ResponseWriter<span class=\"token punctuation\">,<\/span> r <span class=\"token operator\">*<\/span>http<span class=\"token punctuation\">.<\/span>Request<span class=\"token punctuation\">)<\/span> <span class=\"token punctuation\">{<\/span>\r\n\t\tfmt<span class=\"token punctuation\">.<\/span><span class=\"token function\">Fprintf<\/span><span class=\"token punctuation\">(<\/span>w<span class=\"token punctuation\">,<\/span> <span class=\"token string\">\"&lt;h1&gt;\u8fd9\u662f\u4e3b\u9875\u3002\u8bf7\u5c1d\u8bd5\u8bbf\u95ee \/hello \u548c \/hello\/James\r\n&lt;\/h1&gt;\"<\/span><span class=\"token punctuation\">)<\/span>\r\n\t<span class=\"token punctuation\">}<\/span><span class=\"token punctuation\">)<\/span>\r\n\r\n\tr<span class=\"token punctuation\">.<\/span><span class=\"token function\">HandleFunc<\/span><span class=\"token punctuation\">(<\/span><span class=\"token string\">\"\/hello\"<\/span><span class=\"token punctuation\">,<\/span> <span class=\"token keyword\">func<\/span><span class=\"token punctuation\">(<\/span>w http<span class=\"token punctuation\">.<\/span>ResponseWriter<span class=\"token punctuation\">,<\/span> r <span class=\"token operator\">*<\/span>http<span class=\"token punctuation\">.<\/span>Request<span class=\"token punctuation\">)<\/span> <span class=\"token punctuation\">{<\/span>\r\n\t\tfmt<span class=\"token punctuation\">.<\/span><span class=\"token function\">Fprintf<\/span><span class=\"token punctuation\">(<\/span>w<span class=\"token punctuation\">,<\/span> <span class=\"token string\">\"&lt;h1&gt;\u6765\u81ea Docker \u7684\u95ee\u5019\uff01\r\n&lt;\/h1&gt;\"<\/span><span class=\"token punctuation\">)<\/span>\r\n\t<span class=\"token punctuation\">}<\/span><span class=\"token punctuation\">)<\/span>\r\n\r\n\tr<span class=\"token punctuation\">.<\/span><span class=\"token function\">HandleFunc<\/span><span class=\"token punctuation\">(<\/span><span class=\"token string\">\"\/hello\/{name}\"<\/span><span class=\"token punctuation\">,<\/span> <span class=\"token keyword\">func<\/span><span class=\"token punctuation\">(<\/span>w http<span class=\"token punctuation\">.<\/span>ResponseWriter<span class=\"token punctuation\">,<\/span> r <span class=\"token operator\">*<\/span>http<span class=\"token punctuation\">.<\/span>Request<span class=\"token punctuation\">)<\/span> <span class=\"token punctuation\">{<\/span>\r\n\t\tvars <span class=\"token operator\">:=<\/span> mux<span class=\"token punctuation\">.<\/span><span class=\"token function\">Vars<\/span><span class=\"token punctuation\">(<\/span>r<span class=\"token punctuation\">)<\/span>\r\n\t\ttitle <span class=\"token operator\">:=<\/span> vars<span class=\"token punctuation\">[<\/span><span class=\"token string\">\"name\"<\/span><span class=\"token punctuation\">]<\/span>\r\n\r\n\t\tfmt<span class=\"token punctuation\">.<\/span><span class=\"token function\">Fprintf<\/span><span class=\"token punctuation\">(<\/span>w<span class=\"token punctuation\">,<\/span> <span class=\"token string\">\"&lt;h1&gt;\u4f60\u597d\uff0c%s\uff01\r\n&lt;\/h1&gt;\"<\/span><span class=\"token punctuation\">,<\/span> title<span class=\"token punctuation\">)<\/span>\r\n\t<span class=\"token punctuation\">}<\/span><span class=\"token punctuation\">)<\/span>\r\n\r\n\thttp<span class=\"token punctuation\">.<\/span><span class=\"token function\">ListenAndServe<\/span><span class=\"token punctuation\">(<\/span><span class=\"token string\">\":80\"<\/span><span class=\"token punctuation\">,<\/span> r<span class=\"token punctuation\">)<\/span>\r\n<span class=\"token punctuation\">}<\/span>\r\n<\/code><\/pre>\n<p>\u9996\u5148\uff0c\u60a8\u9700\u8981\u5bfc\u5165 <code>net\/http<\/code> \u548c <code>github.com\/gorilla\/mux<\/code> \u5305\u3002<code>net\/http<\/code> \u5305\u63d0\u4f9b\u4e86HTTP\u670d\u52a1\u5668\u529f\u80fd\uff0c\u800c <code>gorilla\/mux<\/code> \u5305\u5219\u63d0\u4f9b\u4e86\u66f4\u5f3a\u5927\u7684\u8bf7\u6c42\u8def\u7531\u5668\u548c\u5206\u53d1\u5668\uff0c\u540c\u65f6\u4fdd\u6301\u4e0e\u6807\u51c6\u8def\u7531\u5668\u7684\u63a5\u53e3\u517c\u5bb9\u6027\u3002<\/p>\n<p>\u60a8\u9700\u8981\u5b9e\u4f8b\u5316\u4e00\u4e2a\u65b0\u7684 <code>mux<\/code> \u8def\u7531\u5668\uff0c\u5e76\u5c06\u5176\u4fdd\u5b58\u5728\u53d8\u91cf <code>r<\/code> \u4e2d\u3002<\/p>\n<p>\u7136\u540e\uff0c\u60a8\u5b9a\u4e49\u4e86\u4e09\u4e2a\u8def\u7531\uff1a<code>\/<\/code>\u3001<code>\/hello<\/code> \u548c <code>\/hello\/{name}<\/code>\u3002\u7b2c\u4e00\u4e2a\u8def\u7531\uff08<code>\/<\/code>\uff09\u4f5c\u4e3a\u4e3b\u9875\uff0c\u5e76\u5305\u542b\u4e86\u4e00\u6761\u63d0\u793a\u4fe1\u606f\u3002\u7b2c\u4e8c\u4e2a\u8def\u7531\uff08<code>\/hello<\/code>\uff09\u5411\u8bbf\u95ee\u8005\u8fd4\u56de\u95ee\u5019\u8bed\u3002\u5bf9\u4e8e\u7b2c\u4e09\u4e2a\u8def\u7531\uff08<code>\/hello\/{name}<\/code>\uff09\uff0c\u60a8\u6307\u5b9a\u5b83\u5e94\u8be5\u63a5\u53d7\u4e00\u4e2a\u540d\u4e3a <code>name<\/code> \u7684\u53c2\u6570\uff0c\u5e76\u663e\u793a\u4e00\u6761\u5305\u542b\u8be5\u540d\u79f0\u7684\u95ee\u5019\u4fe1\u606f\u3002<\/p>\n<p>\u5728\u6587\u4ef6\u672b\u5c3e\uff0c\u60a8\u4f7f\u7528 <code>http.ListenAndServe<\/code> \u542f\u52a8HTTP\u670d\u52a1\u5668\uff0c\u5e76\u6307\u793a\u5b83\u76d1\u542c\u7aef\u53e3 80\uff0c\u4f7f\u7528\u60a8\u914d\u7f6e\u7684\u8def\u7531\u5668\u5904\u7406\u8bf7\u6c42\u3002<\/p>\n<p>\u4fdd\u5b58\u5e76\u5173\u95ed\u6587\u4ef6\u3002<\/p>\n<p>\u5728\u8fd0\u884c\u60a8\u7684Go\u5e94\u7528\u7a0b\u5e8f\u4e4b\u524d\uff0c\u60a8\u9700\u8981\u5c06\u5176\u7f16\u8bd1\u5e76\u6253\u5305\u5230Docker\u5bb9\u5668\u4e2d\u4ee5\u8fdb\u884c\u6267\u884c\u3002Go\u662f\u4e00\u79cd\u7f16\u8bd1\u578b\u8bed\u8a00\uff0c\u56e0\u6b64\u5728\u7a0b\u5e8f\u80fd\u591f\u8fd0\u884c\u4e4b\u524d\uff0c\u7f16\u8bd1\u5668\u4f1a\u5c06\u6e90\u4ee3\u7801\u8f6c\u6362\u4e3a\u53ef\u6267\u884c\u7684\u673a\u5668\u4ee3\u7801\u3002<\/p>\n<p>\u81f3\u6b64\uff0c\u60a8\u5df2\u7ecf\u642d\u5efa\u597d\u4e86\u5de5\u4f5c\u7a7a\u95f4\u5e76\u521b\u5efa\u4e86\u4e00\u4e2a\u793a\u4f8b\u7684Go Web\u5e94\u7528\u7a0b\u5e8f\u3002\u63a5\u4e0b\u6765\uff0c\u60a8\u5c06\u4f7f\u7528\u81ea\u52a8\u5316\u7684Let&#8217;s Encrypt\u8bc1\u4e66\u90e8\u7f72Nginx\u4ee3\u7406\u3002<\/p>\n<h2>\u6b65\u9aa42 \u2014 \u4f7f\u7528Let\u2019s Encrypt\u90e8\u7f72Nginx\u4ee3\u7406<\/h2>\n<p>\u901a\u8fc7HTTPS\u4fdd\u62a4\u60a8\u7684\u5e94\u7528\u7a0b\u5e8f\u81f3\u5173\u91cd\u8981\u3002\u4e3a\u6b64\uff0c\u60a8\u5c06\u4f7f\u7528Docker Compose\u90e8\u7f72<code>nginx-proxy<\/code>\u53ca\u5176Let&#8217;s Encrypt\u9644\u52a0\u7ec4\u4ef6\u3002\u8fd9\u79cd\u8bbe\u7f6e\u5141\u8bb8\u60a8\u901a\u8fc7<code>nginx-proxy<\/code>\u4ee3\u7406\u6765\u4fdd\u62a4Docker\u5bb9\u5668\uff0c\u5e76\u901a\u8fc7\u81ea\u52a8\u5904\u7406TLS\u8bc1\u4e66\u7684\u521b\u5efa\u548c\u66f4\u65b0\u6765\u786e\u4fdd\u60a8\u7684\u5e94\u7528\u7a0b\u5e8f\u7684HTTPS\u5b89\u5168\u3002<\/p>\n<p>\u5c06<code>nginx-proxy<\/code>\u7684Docker Compose\u914d\u7f6e\u5b58\u50a8\u5728\u540d\u4e3a<code>nginx-proxy-compose.yaml<\/code>\u7684\u6587\u4ef6\u4e2d\u3002\u901a\u8fc7\u8fd0\u884c\u4ee5\u4e0b\u547d\u4ee4\u6765\u521b\u5efa\u5b83\uff1a<\/p>\n<pre class=\"post-pre\"><code><ol><li data-prefix=\"$\"><span class=\"token function\">nano<\/span> <mark>nginx-proxy-compose.yaml<\/mark><\/li><\/ol><\/code><\/pre>\n<p>\u5c06\u4ee5\u4e0b\u5185\u5bb9\u6dfb\u52a0\u5230\u6587\u4ef6\u4e2d\uff1a<\/p>\n<p><code>~\/go-docker\/nginx-proxy-compose.yaml<\/code><\/p>\n<pre class=\"post-pre\"><code>version: '3'\r\n\r\nservices:\r\n  nginx-proxy:\r\n    restart: always\r\n    image: jwilder\/nginx-proxy\r\n    ports:\r\n      - \"80:80\"\r\n      - \"443:443\"\r\n    volumes:\r\n      - \"\/etc\/nginx\/vhost.d\"\r\n      - \"\/usr\/share\/nginx\/html\"\r\n      - \"\/var\/run\/docker.sock:\/tmp\/docker.sock:ro\"\r\n      - \"\/etc\/nginx\/certs\"\r\n\r\n  letsencrypt-nginx-proxy-companion:\r\n    restart: always\r\n    image: jrcs\/letsencrypt-nginx-proxy-companion\r\n    volumes:\r\n      - \"\/var\/run\/docker.sock:\/var\/run\/docker.sock:ro\"\r\n    volumes_from:\r\n      - \"nginx-proxy\"<\/code><\/pre>\n<p>\u5728\u6b64\u6587\u4ef6\u4e2d\uff0c\u60a8\u5b9a\u4e49\u4e86\u4e24\u4e2a\u5bb9\u5668\uff1a\u4e00\u4e2a\u7528\u4e8eNginx\u4ee3\u7406\uff08<code>nginx-proxy<\/code>\uff09\uff0c\u53e6\u4e00\u4e2a\u7528\u4e8e\u5176Let&#8217;s Encrypt\u9644\u52a0\u7ec4\u4ef6\uff08<code>letsencrypt-nginx-proxy-companion<\/code>\uff09\u3002\u5bf9\u4e8e\u4ee3\u7406\uff0c\u60a8\u6307\u5b9a\u4e86\u955c\u50cf<code>jwilder\/nginx-proxy<\/code>\uff0c\u66b4\u9732\u5e76\u6620\u5c04\u4e86HTTP\u548cHTTPS\u7aef\u53e3\uff0c\u5e76\u5b9a\u4e49\u4e86\u5377\uff0c\u8fd9\u4e9b\u5377\u53ef\u7528\u4e8e\u5bb9\u5668\u8bbf\u95ee\u6301\u4e45\u5316\u7684Nginx\u76f8\u5173\u6570\u636e\u3002<\/p>\n<p>\u5728\u7b2c\u4e8c\u4e2a\u6a21\u5757\u4e2d\uff0c\u60a8\u4e3aLet&#8217;s Encrypt\u9644\u52a0\u7ec4\u4ef6\u914d\u7f6e\u4e86\u547d\u540d\u955c\u50cf\u3002\u7136\u540e\uff0c\u60a8\u901a\u8fc7\u5b9a\u4e49\u4e00\u4e2a\u5377\u4ee5\u53ca\u4ece\u4ee3\u7406\u5bb9\u5668\u7ee7\u627f\u73b0\u6709\u5377\u6765\u914d\u7f6e\u5bf9Docker\u5957\u63a5\u5b57\u7684\u8bbf\u95ee\u3002\u4e24\u4e2a\u5bb9\u5668\u90fd\u5c06<code>restart<\/code>\u5c5e\u6027\u8bbe\u7f6e\u4e3a<code>always<\/code>\uff0c\u8fd9\u6307\u793aDocker\u59cb\u7ec8\u4fdd\u6301\u5b83\u4eec\u8fd0\u884c\uff08\u5728\u5d29\u6e83\u6216\u7cfb\u7edf\u91cd\u542f\u7684\u60c5\u51b5\u4e0b\uff09\u3002<\/p>\n<p>\u4fdd\u5b58\u5e76\u5173\u95ed\u6587\u4ef6\u3002<\/p>\n<p>\u8fd0\u884c\u4ee5\u4e0b\u547d\u4ee4\u90e8\u7f72Nginx\u4ee3\u7406\uff1a<\/p>\n<pre class=\"post-pre\"><code><ol><li data-prefix=\"$\"><span class=\"token function\">docker<\/span> compose <span class=\"token parameter variable\">-f<\/span> <mark>nginx-proxy-compose.yaml<\/mark> up <span class=\"token parameter variable\">-d<\/span><\/li><\/ol><\/code><\/pre>\n<p>Docker Compose\u53ef\u4ee5\u901a\u8fc7<code>-f<\/code>\u6807\u5fd7\u63a5\u53d7\u81ea\u5b9a\u4e49\u7684\u6587\u4ef6\u540d\u3002<code>up<\/code>\u547d\u4ee4\u7528\u4e8e\u8fd0\u884c\u5bb9\u5668\uff0c\u5e76\u4e14<code>-d<\/code>\u6807\u5fd7\uff08\u540e\u53f0\u6a21\u5f0f\uff09\u6307\u793a\u5b83\u5728\u540e\u53f0\u8fd0\u884c\u5bb9\u5668\u3002<\/p>\n<p>\u60a8\u4f1a\u6536\u5230\u7c7b\u4f3c\u8fd9\u6837\u7684\u8f93\u51fa\uff1a<\/p>\n<pre class=\"post-pre\"><code><div class=\"secondary-code-label\" title=\"Output\">Output<\/div>[+] Running 21\/21\r\n \u283f letsencrypt-nginx-proxy-companion Pulled                            6.8s\r\n   \u283f df9b9388f04a Pull complete                                        3.1s\r\n   \u283f 6c6cfd4eaf5b Pull complete                                        3.9s\r\n   \u283f 870307501973 Pull complete                                        4.3s\r\n   \u283f e8ff3435d14f Pull complete                                        4.5s\r\n   \u283f 5b78ba945919 Pull complete                                        4.8s\r\n   \u283f 973b2ca26006 Pull complete                                        5.0s\r\n \u283f nginx-proxy Pulled                                                  8.1s\r\n   \u283f 42c077c10790 Pull complete                                        3.9s\r\n   \u283f 62c70f376f6a Pull complete                                        5.5s\r\n   \u283f 915cc9bd79c2 Pull complete                                        5.6s\r\n   \u283f 75a963e94de0 Pull complete                                        5.7s\r\n   \u283f 7b1fab684d70 Pull complete                                        5.7s\r\n   \u283f db24d06d5af4 Pull complete                                        5.8s\r\n   \u283f e917373dbecf Pull complete                                        5.9s\r\n   \u283f 11e2be9775e9 Pull complete                                        5.9s\r\n   \u283f 9996fa75bc02 Pull complete                                        6.1s\r\n   \u283f d37674efdf77 Pull complete                                        6.3s\r\n   \u283f a45d84576e75 Pull complete                                        6.3s\r\n   \u283f a13c1f42faf7 Pull complete                                        6.4s\r\n   \u283f 4f4fb700ef54 Pull complete                                        6.5s\r\n[+] Running 3\/3\r\n \u283f Network go-docker_default                                Created    0.1s\r\n \u283f Container go-docker-nginx-proxy-1                        Started    0.5s\r\n \u283f Container go-docker-letsencrypt-nginx-proxy-companion-1  Started    0.8s<\/code><\/pre>\n<p>\u60a8\u5df2\u7ecf\u4f7f\u7528Docker Compose\u90e8\u7f72\u4e86<code>nginx-proxy<\/code>\u53ca\u5176Let&#8217;s Encrypt\u6269\u5c55\u3002\u63a5\u4e0b\u6765\uff0c\u60a8\u5c06\u4e3a\u60a8\u7684Go Web\u5e94\u7528\u7a0b\u5e8f\u521b\u5efa\u4e00\u4e2aDockerfile\u3002<\/p>\n<h2>\u7b2c\u4e09\u6b65 \u2014 Docker\u5316Go Web\u5e94\u7528\u7a0b\u5e8f<\/h2>\n<p>\u5728\u672c\u8282\u4e2d\uff0c\u60a8\u5c06\u51c6\u5907\u4e00\u4e2aDockerfile\uff0c\u5176\u4e2d\u5305\u542b\u6709\u5173Docker\u5982\u4f55\u4e3a\u60a8\u7684Go Web\u5e94\u7528\u7a0b\u5e8f\u521b\u5efa\u4e00\u4e2a\u4e0d\u53ef\u53d8\u955c\u50cf\u7684\u6307\u4ee4\u3002Docker\u4f7f\u7528Dockerfile\u4e2d\u7684\u547d\u4ee4\u6784\u5efa\u4e00\u4e2a\u4e0d\u53ef\u53d8\u7684\u5e94\u7528\u7a0b\u5e8f\u955c\u50cf\uff0c\u7c7b\u4f3c\u4e8e\u5bb9\u5668\u7684\u5feb\u7167\u3002\u955c\u50cf\u7684\u4e0d\u53ef\u53d8\u6027\u4fdd\u8bc1\u4e86\u6bcf\u6b21\u57fa\u4e8e\u7279\u5b9a\u955c\u50cf\u8fd0\u884c\u5bb9\u5668\u65f6\uff0c\u90fd\u4f1a\u63d0\u4f9b\u76f8\u540c\u7684\u73af\u5883\u3002<\/p>\n<p>\u4f7f\u7528\u60a8\u7684\u6587\u672c\u7f16\u8f91\u5668\u521b\u5efaDockerfile\uff1a<\/p>\n<pre class=\"post-pre\"><code><ol><li data-prefix=\"$\"><span class=\"token function\">nano<\/span> Dockerfile<\/li><\/ol><\/code><\/pre>\n<p>\u8bf7\u5728\u4e0b\u9762\u6dfb\u52a0\u4ee5\u4e0b\u5185\u5bb9\uff1a<\/p>\n<p><code>~\/go-docker\/Dockerfile<\/code><\/p>\n<pre class=\"post-pre\"><code>FROM golang:alpine AS build\r\nRUN apk --no-cache add gcc g++ make git\r\nWORKDIR \/go\/src\/app\r\nCOPY . .\r\nRUN go mod init webserver\r\nRUN go mod tidy\r\nRUN GOOS=linux go build -ldflags=\"-s -w\" -o .\/bin\/web-app .\/main.go\r\n\r\nFROM alpine:3.17\r\nRUN apk --no-cache add ca-certificates\r\nWORKDIR \/usr\/bin\r\nCOPY --from=build \/go\/src\/app\/bin \/go\/bin\r\nEXPOSE 80\r\nENTRYPOINT \/go\/bin\/web-app --port 80<\/code><\/pre>\n<p>\u8fd9\u4e2aDockerfile\u6709\u4e24\u4e2a\u9636\u6bb5\u3002\u7b2c\u4e00\u9636\u6bb5\u4f7f\u7528\u4e86<code>golang:alpine<\/code>\u57fa\u7840\u955c\u50cf\uff0c\u5176\u4e2d\u5df2\u7ecf\u9884\u5148\u5728Alpine Linux\u4e0a\u5b89\u88c5\u4e86Go\u3002<\/p>\n<p>\u7136\u540e\uff0c\u60a8\u5c06<code>gcc<\/code>\u3001<code>g++<\/code>\u3001<code>make<\/code>\u548c<code>git<\/code>\u5b89\u88c5\u4e3aGo\u5e94\u7528\u7a0b\u5e8f\u7684\u5fc5\u8981\u7f16\u8bd1\u5de5\u5177\u3002\u60a8\u5c06\u5de5\u4f5c\u76ee\u5f55\u8bbe\u7f6e\u4e3a<code>\/go\/src\/app<\/code>\uff0c\u8be5\u76ee\u5f55\u4f4d\u4e8e\u9ed8\u8ba4\u7684GOPATH\u4e0b\u3002\u60a8\u8fd8\u5c06\u5f53\u524d\u76ee\u5f55\u7684\u5185\u5bb9\u590d\u5236\u5230\u5bb9\u5668\u4e2d\u3002\u7b2c\u4e00\u9636\u6bb5\u901a\u8fc7\u9012\u5f52\u83b7\u53d6\u4ee3\u7801\u4e2d\u4f7f\u7528\u7684\u8f6f\u4ef6\u5305\uff0c\u5e76\u4f7f\u7528<code>-ldflags=\"-s -w\"<\/code>\u53c2\u6570\u7f16\u8bd1<code>main.go<\/code>\u6587\u4ef6\uff0c\u4ee5\u5728\u53d1\u5e03\u65f6\u53bb\u9664\u7b26\u53f7\u548c\u8c03\u8bd5\u4fe1\u606f\u3002<\/p>\n<div class=\"post-conf-note\">\n<p class=\"post-note\">\n<p class=\"post-conf-desc\">\u6ce8\u610f\uff1a\u5f53\u60a8\u7f16\u8bd1\u4e00\u4e2aGo\u7a0b\u5e8f\u65f6\uff0c\u5b83\u4f1a\u4fdd\u7559\u4e00\u4e2a\u7528\u4e8e\u8c03\u8bd5\u7684\u72ec\u7acb\u4e8c\u8fdb\u5236\u90e8\u5206\uff1b\u7136\u800c\uff0c\u8fd9\u4e9b\u989d\u5916\u7684\u4fe1\u606f\u4f1a\u5360\u7528\u5185\u5b58\uff0c\u5e76\u4e14\u5728\u90e8\u7f72\u5230\u751f\u4ea7\u73af\u5883\u65f6\u662f\u4e0d\u5fc5\u8981\u4fdd\u7559\u7684\u3002<\/p>\n<\/div>\n<p>\u7b2c\u4e8c\u9636\u6bb5\u57fa\u4e8e<code>alpine:3.17<\/code>\uff08Alpine Linux 3.17\uff09\u955c\u50cf\u3002\u5b83\u5b89\u88c5\u4e86\u53ef\u4fe1\u8d56\u7684CA\u8bc1\u4e66\uff0c\u5c06\u7b2c\u4e00\u9636\u6bb5\u7f16\u8bd1\u597d\u7684\u5e94\u7528\u7a0b\u5e8f\u4e8c\u8fdb\u5236\u6587\u4ef6\u590d\u5236\u5230\u5f53\u524d\u955c\u50cf\u4e2d\uff0c\u66b4\u9732\u7aef\u53e380\uff0c\u5e76\u5c06\u5e94\u7528\u7a0b\u5e8f\u4e8c\u8fdb\u5236\u6587\u4ef6\u8bbe\u7f6e\u4e3a\u955c\u50cf\u7684\u5165\u53e3\u70b9\u3002<\/p>\n<p>\u4fdd\u5b58\u5e76\u5173\u95ed\u6587\u4ef6\u3002<\/p>\n<p>\u4f60\u5df2\u7ecf\u4e3a\u4f60\u7684Go\u5e94\u7528\u7a0b\u5e8f\u521b\u5efa\u4e86\u4e00\u4e2a<code>Dockerfile<\/code>\uff0c\u5b83\u80fd\u591f\u5728\u5bb9\u5668\u521b\u5efa\u65f6\u83b7\u53d6\u4f9d\u8d56\u3001\u7f16\u8bd1\u5e76\u8fd0\u884c\u5e94\u7528\u7a0b\u5e8f\u3002\u4e0b\u4e00\u6b65\uff0c\u4f60\u5c06\u521b\u5efaDocker Compose YAML\u6587\u4ef6\uff0c\u5e76\u5728Docker\u4e2d\u8fd0\u884c\u5b83\u6765\u6d4b\u8bd5\u8fd9\u4e2a\u5e94\u7528\u7a0b\u5e8f\u3002<\/p>\n<h2>\u7b2c\u56db\u6b65 \u2014 \u521b\u5efa\u5e76\u8fd0\u884cDocker Compose\u6587\u4ef6<\/h2>\n<p>\u73b0\u5728\uff0c\u4f60\u5c06\u521b\u5efaDocker Compose\u914d\u7f6e\u6587\u4ef6\uff0c\u5e76\u7f16\u5199\u5fc5\u8981\u7684\u914d\u7f6e\uff0c\u4ee5\u8fd0\u884c\u4f60\u5728\u4e0a\u4e00\u6b65\u4e2d\u521b\u5efa\u7684Docker\u955c\u50cf\u3002\u7136\u540e\uff0c\u4f60\u5c06\u8fd0\u884c\u5b83\u5e76\u68c0\u67e5\u662f\u5426\u6b63\u5e38\u5de5\u4f5c\u3002\u901a\u5e38\uff0cDocker Compose\u914d\u7f6e\u6587\u4ef6\u6307\u5b9a\u4e86\u5e94\u7528\u7a0b\u5e8f\u6240\u9700\u7684\u5bb9\u5668\u3001\u8bbe\u7f6e\u3001\u7f51\u7edc\u548c\u5377\u3002\u4f60\u8fd8\u53ef\u4ee5\u6307\u5b9a\u8fd9\u4e9b\u5143\u7d20\u4f5c\u4e3a\u4e00\u4e2a\u6574\u4f53\u542f\u52a8\u548c\u505c\u6b62\u3002<\/p>\n<p>\u4f60\u5c06\u628aGo Web\u5e94\u7528\u7a0b\u5e8f\u7684Docker Compose\u914d\u7f6e\u5b58\u50a8\u5728\u4e00\u4e2a\u540d\u4e3a<code>go-app-compose.yaml<\/code>\u7684\u6587\u4ef6\u4e2d\u3002\u901a\u8fc7\u8fd0\u884c\u4ee5\u4e0b\u547d\u4ee4\u6765\u521b\u5efa\u5b83\uff1a<\/p>\n<pre class=\"post-pre\"><code><ol><li data-prefix=\"$\"><span class=\"token function\">nano<\/span> <mark>go-app-compose.yaml<\/mark><\/li><\/ol><\/code><\/pre>\n<p>\u5c06\u4ee5\u4e0b\u5185\u5bb9\u6dfb\u52a0\u5230\u6b64\u6587\u4ef6\u4e2d\uff1a<\/p>\n<div>~\/go-docker\/go-app-compose.yaml<\/div>\n<pre class=\"post-pre\"><code>version: '3'\r\nservices:\r\n  go-web-app:\r\n    restart: always\r\n    build:\r\n      dockerfile: Dockerfile\r\n      context: .\r\n    environment:\r\n      - VIRTUAL_HOST=<mark>your_domain<\/mark>\r\n      - LETSENCRYPT_HOST=<mark>your_domain<\/mark><\/code><\/pre>\n<p>\u5c06\u201c<code>your_domain<\/code>\u201d\u8fd9\u4e2a\u8bcd\u66ff\u6362\u4e3a\u4f60\u7684\u57df\u540d\u4e24\u6b21\u3002\u4fdd\u5b58\u5e76\u5173\u95ed\u6587\u4ef6\u3002<\/p>\n<p>\u8fd9\u4e2aDocker Compose\u914d\u7f6e\u5305\u542b\u4e00\u4e2a\u5bb9\u5668\uff08<code>go-web-app<\/code>\uff09\uff0c\u5b83\u5c06\u627f\u8f7d\u4f60\u7684Go Web\u5e94\u7528\u7a0b\u5e8f\u3002\u5b83\u4f7f\u7528\u4f60\u5728\u4e0a\u4e00\u6b65\u521b\u5efa\u7684<code>Dockerfile<\/code>\u6765\u6784\u5efa\u5e94\u7528\u7a0b\u5e8f\uff0c\u5e76\u91c7\u7528\u5305\u542b\u6e90\u4ee3\u7801\u7684\u5f53\u524d\u76ee\u5f55\u4f5c\u4e3a\u6784\u5efa\u4e0a\u4e0b\u6587\u3002\u6b64\u5916\uff0c\u5b83\u8bbe\u7f6e\u4e86\u4e24\u4e2a\u73af\u5883\u53d8\u91cf\uff1a<code>VIRTUAL_HOST<\/code>\u548c<code>LETSENCRYPT_HOST<\/code>\u3002<code>nginx-proxy<\/code>\u4f7f\u7528<code>VIRTUAL_HOST<\/code>\u6765\u786e\u5b9a\u4ece\u54ea\u4e2a\u57df\u540d\u63a5\u53d7\u8bf7\u6c42\u3002<code>LETSENCRYPT_HOST<\/code>\u6307\u5b9a\u751f\u6210TLS\u8bc1\u4e66\u7684\u57df\u540d\uff0c\u5b83\u5fc5\u987b\u4e0e<code>VIRTUAL_HOST<\/code>\u76f8\u540c\uff0c\u9664\u975e\u4f60\u6307\u5b9a\u4e86\u901a\u914d\u7b26\u57df\u540d\u3002<\/p>\n<p>\u901a\u8fc7Docker Compose\u5728\u540e\u53f0\u8fd0\u884c\u4f60\u7684Go Web\u5e94\u7528\u7a0b\u5e8f\u3002<\/p>\n<pre class=\"post-pre\"><code><ol><li data-prefix=\"$\"><span class=\"token function\">docker<\/span> compose <span class=\"token parameter variable\">-f<\/span> go-app-compose.yaml up <span class=\"token parameter variable\">-d<\/span><\/li><\/ol><\/code><\/pre>\n<p>\u5c06\u6253\u5370\u51fa\u4ee5\u4e0b\u8f93\u51fa\uff08\u4e3a\u4fbf\u4e8e\u9605\u8bfb\uff0c\u5df2\u8fdb\u884c\u622a\u65ad\uff09\uff1a<\/p>\n<pre class=\"post-pre\"><code><div class=\"secondary-code-label\" title=\"Output\">\u8f93\u51fa<\/div>Creating network \"go-docker_default\" with the default driver\r\nBuilding go-web-app\r\nStep 1\/13 : FROM golang:alpine AS build\r\n ---&gt; b97a72b8e97d\r\n...\r\nSuccessfully built 71e4b1ef2e25\r\nSuccessfully tagged go-docker_go-web-app:latest\r\n...\r\n[+] Running 1\/1\r\n \u283f Container go-docker-go-web-app-1  Started<\/code><\/pre>\n<p>\u5982\u679c\u4f60\u5728\u8fd0\u884c\u547d\u4ee4\u540e\u67e5\u770b\u8f93\u51fa\uff0cDocker\u4f1a\u6839\u636e<code>Dockerfile<\/code>\u4e2d\u7684\u914d\u7f6e\u8bb0\u5f55\u6784\u5efa\u5e94\u7528\u7a0b\u5e8f\u955c\u50cf\u7684\u6bcf\u4e2a\u6b65\u9aa4\u3002<\/p>\n<p>\u73b0\u5728\u4f60\u53ef\u4ee5\u5bfc\u822a\u81f3<code>https:\/\/your_domain\/<\/code>\u6765\u8bbf\u95ee\u4f60\u7684\u9996\u9875\u3002\u5728\u4f60\u7684Web\u5e94\u7528\u7a0b\u5e8f\u7684\u4e3b\u8981\u5730\u5740\uff0c\u4f60\u53ef\u4ee5\u901a\u8fc7\u5728\u7b2c\u4e00\u6b65\u4e2d\u5b9a\u4e49\u7684<code>\/<\/code>\u8def\u7531\u6765\u8bbf\u95ee\u8be5\u9875\u9762\u3002<\/p>\n<div><img decoding=\"async\" src=\"https:\/\/cdn.silicloud.com\/blog-img\/blog\/img\/65645b10a4b2f92e6c722bcf\/68-0.png\" class='post-images' alt=\"\u663e\u793a\u201c\u8fd9\u662f\u4e3b\u9875\u3002\u5c1d\u8bd5\/hello\u548c\/hello\/James\u201d\u7684\u57df\u540d\u9875\u9762\u622a\u56fe\" title=\"\"><\/div>\n<p>\u73b0\u5728\u5bfc\u822a\u5230<code>https:\/\/your_domain\/hello<\/code>\u3002\u4f60\u5728\u7b2c\u4e00\u6b65\u4e2d\u4e3a<code>\/hello<\/code>\u8def\u5f84\u5b9a\u4e49\u7684\u4ee3\u7801\u4e2d\u7684\u6d88\u606f\u5c06\u4f1a\u52a0\u8f7d\u3002<\/p>\n<div><img decoding=\"async\" src=\"https:\/\/cdn.silicloud.com\/blog-img\/blog\/img\/65645b10a4b2f92e6c722bcf\/70-0.png\" class='post-images' alt=\"\u663e\u793a\u201c\u6765\u81eaDocker\u7684\u95ee\u5019\uff01\u201d\u7684\/hello\u8def\u7531\u622a\u56fe\" title=\"\"><\/div>\n<p>\u6700\u540e\uff0c\u5728\u4f60\u7684\u7f51\u5740\u4e2d\u6dfb\u52a0\u4e00\u4e2a\u540d\u5b57\u6765\u6d4b\u8bd5\u5176\u4ed6\u8def\u7531\uff0c\u4f8b\u5982\uff1a<code>https:\/\/your_domain\/hello\/James<\/code>\u3002<\/p>\n<div><img decoding=\"async\" src=\"https:\/\/cdn.silicloud.com\/blog-img\/blog\/img\/65645b10a4b2f92e6c722bcf\/72-0.png\" class='post-images' alt=\"\u663e\u793a\u201c\u4f60\u597d\uff0cJames\uff01\u201d\u7684\u5e26\u540d\u5b57\u8def\u7531\u622a\u56fe\uff0c\u5176\u4e2d\u540d\u5b57\u8f93\u5165\u4e3a\u201cJames\u201d\" title=\"\"><\/div>\n<div class=\"post-conf-note\">\n<p class=\"post-note\">\n<p class=\"post-conf-desc\">\u6ce8\u610f\uff1a<\/p>\n<div>\u5982\u679c\u6536\u5230\u65e0\u6548\u7684TLS\u8bc1\u4e66\u9519\u8bef\uff0c\u8bf7\u7b49\u5f85\u51e0\u5206\u949f\uff0c\u4ee5\u4fbf\u8ba9Let&#8217;s Encrypt\u6269\u5c55\u914d\u7f6e\u8bc1\u4e66\u3002\u5982\u679c\u77ed\u65f6\u95f4\u5185\u4ecd\u7136\u51fa\u73b0\u9519\u8bef\uff0c\u8bf7\u4ed4\u7ec6\u5bf9\u7167\u672c\u6b65\u9aa4\u4e2d\u7684\u547d\u4ee4\u548c\u914d\u7f6e\uff0c\u786e\u8ba4\u8f93\u5165\u7684\u5185\u5bb9\u662f\u5426\u6b63\u786e\u3002<\/div>\n<\/p>\n<\/div>\n<p>\u4f60\u5df2\u7ecf\u521b\u5efa\u4e86Docker Compose\u6587\u4ef6\uff0c\u5e76\u7f16\u5199\u4e86\u5728\u5bb9\u5668\u5185\u8fd0\u884cGo\u5e94\u7528\u7a0b\u5e8f\u7684\u914d\u7f6e\u3002\u6700\u540e\uff0c\u4f60\u5bfc\u822a\u5230\u4f60\u7684\u57df\u540d\u4e0a\u68c0\u67e5<code>gorilla\/mux<\/code>\u8def\u7531\u5668\u662f\u5426\u6b63\u786e\u5730\u4e3a\u4f60\u7684Docker\u5316Go Web\u5e94\u7528\u7a0b\u5e8f\u63d0\u4f9b\u8bf7\u6c42\u670d\u52a1\u3002<\/p>\n<h2>\u7ed3\u8bba<\/h2>\n<p>\u4f60\u73b0\u5728\u5df2\u7ecf\u6210\u529f\u5730\u4f7f\u7528Docker\u548cNginx\u5728Ubuntu 22.04\u4e0a\u90e8\u7f72\u4e86\u4f60\u7684Go Web\u5e94\u7528\u7a0b\u5e8f\u3002\u901a\u8fc7\u4f7f\u7528Docker\uff0c\u5e94\u7528\u7a0b\u5e8f\u7684\u7ef4\u62a4\u53d8\u5f97\u4e0d\u90a3\u4e48\u8017\u65f6\uff0c\u56e0\u4e3a\u6bcf\u6b21\u8fd0\u884c\u65f6\u6267\u884c\u7684\u73af\u5883\u90fd\u662f\u4fdd\u8bc1\u4e00\u81f4\u7684\u3002<code>gorilla\/mux<\/code>\u5305\u6709\u5f88\u597d\u7684\u6587\u6863\uff0c\u5e76\u63d0\u4f9b\u66f4\u590d\u6742\u7684\u529f\u80fd\uff0c\u6bd4\u5982\u547d\u540d\u8def\u7531\u548c\u63d0\u4f9b\u9759\u6001\u6587\u4ef6\u670d\u52a1\u3002\u5982\u679c\u4f60\u5e0c\u671b\u5bf9Go HTTP\u670d\u52a1\u5668\u6a21\u5757\u6709\u66f4\u591a\u7684\u63a7\u5236\uff0c\u6bd4\u5982\u5b9a\u4e49\u81ea\u5b9a\u4e49\u8d85\u65f6\u65f6\u95f4\uff0c\u53ef\u4ee5\u67e5\u9605\u5b98\u65b9\u6587\u6863\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u7b80\u4ecb Docker\u662f\u4e00\u79cd\u6d41\u884c\u7684\u5bb9\u5668\u5316\u8f6f\u4ef6\uff0c\u5b83\u4f7f\u5f00\u53d1\u4eba\u5458\u80fd\u591f\u8f7b\u677e\u6253\u5305\u5e94\u7528\u7a0b\u5e8f\u53ca\u5176\u8fd0\u884c\u73af\u5883\uff0c\u4ece\u800c\u5b9e\u73b0\u66f4\u5feb\u7684\u8fed\u4ee3\u5468\u671f [&hellip;]<\/p>\n","protected":false},"author":8,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[512,511,288,513,300],"class_list":["post-99","post","type-post","status-publish","format-standard","hentry","category-uncategorized","tag-docker","tag-go-web","tag-go","tag-nginx","tag-ubuntu-22-04"],"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v21.5 (Yoast SEO v21.5) - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Ubuntu 22.04\u4e0a\u4f7f\u7528Docker\u548cNginx\u90e8\u7f72Go Web\u5e94\u7528\uff1a\u5b8c\u6574\u6307\u5357 - Blog - Silicon Cloud<\/title>\n<meta name=\"description\" content=\"\u672c\u6307\u5357\u8be6\u7ec6\u4ecb\u7ecd\u4e86\u5982\u4f55\u5728Ubuntu 22.04\u670d\u52a1\u5668\u4e0a\uff0c\u5229\u7528Docker\u5bb9\u5668\u5316\u6280\u672f\u548cNginx\u53cd\u5411\u4ee3\u7406\uff0c\u9ad8\u6548\u90e8\u7f72\u60a8\u7684Go Web\u5e94\u7528\u7a0b\u5e8f\u3002\u4ece\u73af\u5883\u642d\u5efa\u5230\u5e94\u7528\u4e0a\u7ebf\uff0c\u4e00\u6b65\u6b65\u6559\u60a8\u5b9e\u73b0\u7a33\u5b9a\u53ef\u9760\u7684Go\u5e94\u7528\u90e8\u7f72\u65b9\u6848\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.silicloud.com\/zh\/blog\/\u5982\u4f55\u5728ubuntu-22-04\u4e0a\u4f7f\u7528docker\u548cnginx\u90e8\u7f72go-web\u5e94\u7528\u7a0b\u5e8f\u3002\/\" \/>\n<meta property=\"og:locale\" content=\"zh_CN\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Ubuntu 22.04\u4e0a\u4f7f\u7528Docker\u548cNginx\u90e8\u7f72Go Web\u5e94\u7528\uff1a\u5b8c\u6574\u6307\u5357\" \/>\n<meta property=\"og:description\" content=\"\u672c\u6307\u5357\u8be6\u7ec6\u4ecb\u7ecd\u4e86\u5982\u4f55\u5728Ubuntu 22.04\u670d\u52a1\u5668\u4e0a\uff0c\u5229\u7528Docker\u5bb9\u5668\u5316\u6280\u672f\u548cNginx\u53cd\u5411\u4ee3\u7406\uff0c\u9ad8\u6548\u90e8\u7f72\u60a8\u7684Go Web\u5e94\u7528\u7a0b\u5e8f\u3002\u4ece\u73af\u5883\u642d\u5efa\u5230\u5e94\u7528\u4e0a\u7ebf\uff0c\u4e00\u6b65\u6b65\u6559\u60a8\u5b9e\u73b0\u7a33\u5b9a\u53ef\u9760\u7684Go\u5e94\u7528\u90e8\u7f72\u65b9\u6848\u3002\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.silicloud.com\/zh\/blog\/\u5982\u4f55\u5728ubuntu-22-04\u4e0a\u4f7f\u7528docker\u548cnginx\u90e8\u7f72go-web\u5e94\u7528\u7a0b\u5e8f\u3002\/\" \/>\n<meta property=\"og:site_name\" content=\"Blog - Silicon Cloud\" \/>\n<meta property=\"article:published_time\" content=\"2023-06-04T16:21:35+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2025-07-31T14:53:02+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/cdn.silicloud.com\/blog-img\/blog\/img\/65645b10a4b2f92e6c722bcf\/68-0.png\" \/>\n<meta name=\"author\" content=\"\u96c5, \u609f\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"\u4f5c\u8005\" \/>\n\t<meta name=\"twitter:data1\" content=\"\u96c5, \u609f\" \/>\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.silicloud.com\/zh\/blog\/%e5%a6%82%e4%bd%95%e5%9c%a8ubuntu-22-04%e4%b8%8a%e4%bd%bf%e7%94%a8docker%e5%92%8cnginx%e9%83%a8%e7%bd%b2go-web%e5%ba%94%e7%94%a8%e7%a8%8b%e5%ba%8f%e3%80%82\/\",\"url\":\"https:\/\/www.silicloud.com\/zh\/blog\/%e5%a6%82%e4%bd%95%e5%9c%a8ubuntu-22-04%e4%b8%8a%e4%bd%bf%e7%94%a8docker%e5%92%8cnginx%e9%83%a8%e7%bd%b2go-web%e5%ba%94%e7%94%a8%e7%a8%8b%e5%ba%8f%e3%80%82\/\",\"name\":\"Ubuntu 22.04\u4e0a\u4f7f\u7528Docker\u548cNginx\u90e8\u7f72Go Web\u5e94\u7528\uff1a\u5b8c\u6574\u6307\u5357 - Blog - Silicon Cloud\",\"isPartOf\":{\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/#website\"},\"datePublished\":\"2023-06-04T16:21:35+00:00\",\"dateModified\":\"2025-07-31T14:53:02+00:00\",\"author\":{\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/#\/schema\/person\/f044a4b7fa4ee2701702942002419ca6\"},\"description\":\"\u672c\u6307\u5357\u8be6\u7ec6\u4ecb\u7ecd\u4e86\u5982\u4f55\u5728Ubuntu 22.04\u670d\u52a1\u5668\u4e0a\uff0c\u5229\u7528Docker\u5bb9\u5668\u5316\u6280\u672f\u548cNginx\u53cd\u5411\u4ee3\u7406\uff0c\u9ad8\u6548\u90e8\u7f72\u60a8\u7684Go Web\u5e94\u7528\u7a0b\u5e8f\u3002\u4ece\u73af\u5883\u642d\u5efa\u5230\u5e94\u7528\u4e0a\u7ebf\uff0c\u4e00\u6b65\u6b65\u6559\u60a8\u5b9e\u73b0\u7a33\u5b9a\u53ef\u9760\u7684Go\u5e94\u7528\u90e8\u7f72\u65b9\u6848\u3002\",\"breadcrumb\":{\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/%e5%a6%82%e4%bd%95%e5%9c%a8ubuntu-22-04%e4%b8%8a%e4%bd%bf%e7%94%a8docker%e5%92%8cnginx%e9%83%a8%e7%bd%b2go-web%e5%ba%94%e7%94%a8%e7%a8%8b%e5%ba%8f%e3%80%82\/#breadcrumb\"},\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.silicloud.com\/zh\/blog\/%e5%a6%82%e4%bd%95%e5%9c%a8ubuntu-22-04%e4%b8%8a%e4%bd%bf%e7%94%a8docker%e5%92%8cnginx%e9%83%a8%e7%bd%b2go-web%e5%ba%94%e7%94%a8%e7%a8%8b%e5%ba%8f%e3%80%82\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/%e5%a6%82%e4%bd%95%e5%9c%a8ubuntu-22-04%e4%b8%8a%e4%bd%bf%e7%94%a8docker%e5%92%8cnginx%e9%83%a8%e7%bd%b2go-web%e5%ba%94%e7%94%a8%e7%a8%8b%e5%ba%8f%e3%80%82\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\u9996\u9875\",\"item\":\"https:\/\/www.silicloud.com\/zh\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Ubuntu 22.04\u4e0a\u4f7f\u7528Docker\u548cNginx\u90e8\u7f72Go Web\u5e94\u7528\uff1a\u5b8c\u6574\u6307\u5357\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/#website\",\"url\":\"https:\/\/www.silicloud.com\/zh\/blog\/\",\"name\":\"Blog - Silicon Cloud\",\"description\":\"\",\"inLanguage\":\"zh-Hans\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/#\/schema\/person\/f044a4b7fa4ee2701702942002419ca6\",\"name\":\"\u96c5, \u609f\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"zh-Hans\",\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/e71a913e914f1aad1efc391f92084294bac54bc782acd289638580134cf667a6?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/e71a913e914f1aad1efc391f92084294bac54bc782acd289638580134cf667a6?s=96&d=mm&r=g\",\"caption\":\"\u96c5, \u609f\"},\"url\":\"https:\/\/www.silicloud.com\/zh\/blog\/author\/yawu\/\"},{\"@type\":\"ImageObject\",\"inLanguage\":\"zh-Hans\",\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/%e5%a6%82%e4%bd%95%e5%9c%a8ubuntu-22-04%e4%b8%8a%e4%bd%bf%e7%94%a8docker%e5%92%8cnginx%e9%83%a8%e7%bd%b2go-web%e5%ba%94%e7%94%a8%e7%a8%8b%e5%ba%8f%e3%80%82\/#local-main-organization-logo\",\"url\":\"\",\"contentUrl\":\"\",\"caption\":\"Blog - Silicon Cloud\"}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"Ubuntu 22.04\u4e0a\u4f7f\u7528Docker\u548cNginx\u90e8\u7f72Go Web\u5e94\u7528\uff1a\u5b8c\u6574\u6307\u5357 - Blog - Silicon Cloud","description":"\u672c\u6307\u5357\u8be6\u7ec6\u4ecb\u7ecd\u4e86\u5982\u4f55\u5728Ubuntu 22.04\u670d\u52a1\u5668\u4e0a\uff0c\u5229\u7528Docker\u5bb9\u5668\u5316\u6280\u672f\u548cNginx\u53cd\u5411\u4ee3\u7406\uff0c\u9ad8\u6548\u90e8\u7f72\u60a8\u7684Go Web\u5e94\u7528\u7a0b\u5e8f\u3002\u4ece\u73af\u5883\u642d\u5efa\u5230\u5e94\u7528\u4e0a\u7ebf\uff0c\u4e00\u6b65\u6b65\u6559\u60a8\u5b9e\u73b0\u7a33\u5b9a\u53ef\u9760\u7684Go\u5e94\u7528\u90e8\u7f72\u65b9\u6848\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.silicloud.com\/zh\/blog\/\u5982\u4f55\u5728ubuntu-22-04\u4e0a\u4f7f\u7528docker\u548cnginx\u90e8\u7f72go-web\u5e94\u7528\u7a0b\u5e8f\u3002\/","og_locale":"zh_CN","og_type":"article","og_title":"Ubuntu 22.04\u4e0a\u4f7f\u7528Docker\u548cNginx\u90e8\u7f72Go Web\u5e94\u7528\uff1a\u5b8c\u6574\u6307\u5357","og_description":"\u672c\u6307\u5357\u8be6\u7ec6\u4ecb\u7ecd\u4e86\u5982\u4f55\u5728Ubuntu 22.04\u670d\u52a1\u5668\u4e0a\uff0c\u5229\u7528Docker\u5bb9\u5668\u5316\u6280\u672f\u548cNginx\u53cd\u5411\u4ee3\u7406\uff0c\u9ad8\u6548\u90e8\u7f72\u60a8\u7684Go Web\u5e94\u7528\u7a0b\u5e8f\u3002\u4ece\u73af\u5883\u642d\u5efa\u5230\u5e94\u7528\u4e0a\u7ebf\uff0c\u4e00\u6b65\u6b65\u6559\u60a8\u5b9e\u73b0\u7a33\u5b9a\u53ef\u9760\u7684Go\u5e94\u7528\u90e8\u7f72\u65b9\u6848\u3002","og_url":"https:\/\/www.silicloud.com\/zh\/blog\/\u5982\u4f55\u5728ubuntu-22-04\u4e0a\u4f7f\u7528docker\u548cnginx\u90e8\u7f72go-web\u5e94\u7528\u7a0b\u5e8f\u3002\/","og_site_name":"Blog - Silicon Cloud","article_published_time":"2023-06-04T16:21:35+00:00","article_modified_time":"2025-07-31T14:53:02+00:00","og_image":[{"url":"https:\/\/cdn.silicloud.com\/blog-img\/blog\/img\/65645b10a4b2f92e6c722bcf\/68-0.png"}],"author":"\u96c5, \u609f","twitter_card":"summary_large_image","twitter_misc":{"\u4f5c\u8005":"\u96c5, \u609f","\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4":"2 \u5206"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.silicloud.com\/zh\/blog\/%e5%a6%82%e4%bd%95%e5%9c%a8ubuntu-22-04%e4%b8%8a%e4%bd%bf%e7%94%a8docker%e5%92%8cnginx%e9%83%a8%e7%bd%b2go-web%e5%ba%94%e7%94%a8%e7%a8%8b%e5%ba%8f%e3%80%82\/","url":"https:\/\/www.silicloud.com\/zh\/blog\/%e5%a6%82%e4%bd%95%e5%9c%a8ubuntu-22-04%e4%b8%8a%e4%bd%bf%e7%94%a8docker%e5%92%8cnginx%e9%83%a8%e7%bd%b2go-web%e5%ba%94%e7%94%a8%e7%a8%8b%e5%ba%8f%e3%80%82\/","name":"Ubuntu 22.04\u4e0a\u4f7f\u7528Docker\u548cNginx\u90e8\u7f72Go Web\u5e94\u7528\uff1a\u5b8c\u6574\u6307\u5357 - Blog - Silicon Cloud","isPartOf":{"@id":"https:\/\/www.silicloud.com\/zh\/blog\/#website"},"datePublished":"2023-06-04T16:21:35+00:00","dateModified":"2025-07-31T14:53:02+00:00","author":{"@id":"https:\/\/www.silicloud.com\/zh\/blog\/#\/schema\/person\/f044a4b7fa4ee2701702942002419ca6"},"description":"\u672c\u6307\u5357\u8be6\u7ec6\u4ecb\u7ecd\u4e86\u5982\u4f55\u5728Ubuntu 22.04\u670d\u52a1\u5668\u4e0a\uff0c\u5229\u7528Docker\u5bb9\u5668\u5316\u6280\u672f\u548cNginx\u53cd\u5411\u4ee3\u7406\uff0c\u9ad8\u6548\u90e8\u7f72\u60a8\u7684Go Web\u5e94\u7528\u7a0b\u5e8f\u3002\u4ece\u73af\u5883\u642d\u5efa\u5230\u5e94\u7528\u4e0a\u7ebf\uff0c\u4e00\u6b65\u6b65\u6559\u60a8\u5b9e\u73b0\u7a33\u5b9a\u53ef\u9760\u7684Go\u5e94\u7528\u90e8\u7f72\u65b9\u6848\u3002","breadcrumb":{"@id":"https:\/\/www.silicloud.com\/zh\/blog\/%e5%a6%82%e4%bd%95%e5%9c%a8ubuntu-22-04%e4%b8%8a%e4%bd%bf%e7%94%a8docker%e5%92%8cnginx%e9%83%a8%e7%bd%b2go-web%e5%ba%94%e7%94%a8%e7%a8%8b%e5%ba%8f%e3%80%82\/#breadcrumb"},"inLanguage":"zh-Hans","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.silicloud.com\/zh\/blog\/%e5%a6%82%e4%bd%95%e5%9c%a8ubuntu-22-04%e4%b8%8a%e4%bd%bf%e7%94%a8docker%e5%92%8cnginx%e9%83%a8%e7%bd%b2go-web%e5%ba%94%e7%94%a8%e7%a8%8b%e5%ba%8f%e3%80%82\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.silicloud.com\/zh\/blog\/%e5%a6%82%e4%bd%95%e5%9c%a8ubuntu-22-04%e4%b8%8a%e4%bd%bf%e7%94%a8docker%e5%92%8cnginx%e9%83%a8%e7%bd%b2go-web%e5%ba%94%e7%94%a8%e7%a8%8b%e5%ba%8f%e3%80%82\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\u9996\u9875","item":"https:\/\/www.silicloud.com\/zh\/blog\/"},{"@type":"ListItem","position":2,"name":"Ubuntu 22.04\u4e0a\u4f7f\u7528Docker\u548cNginx\u90e8\u7f72Go Web\u5e94\u7528\uff1a\u5b8c\u6574\u6307\u5357"}]},{"@type":"WebSite","@id":"https:\/\/www.silicloud.com\/zh\/blog\/#website","url":"https:\/\/www.silicloud.com\/zh\/blog\/","name":"Blog - Silicon Cloud","description":"","inLanguage":"zh-Hans"},{"@type":"Person","@id":"https:\/\/www.silicloud.com\/zh\/blog\/#\/schema\/person\/f044a4b7fa4ee2701702942002419ca6","name":"\u96c5, \u609f","image":{"@type":"ImageObject","inLanguage":"zh-Hans","@id":"https:\/\/www.silicloud.com\/zh\/blog\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/e71a913e914f1aad1efc391f92084294bac54bc782acd289638580134cf667a6?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/e71a913e914f1aad1efc391f92084294bac54bc782acd289638580134cf667a6?s=96&d=mm&r=g","caption":"\u96c5, \u609f"},"url":"https:\/\/www.silicloud.com\/zh\/blog\/author\/yawu\/"},{"@type":"ImageObject","inLanguage":"zh-Hans","@id":"https:\/\/www.silicloud.com\/zh\/blog\/%e5%a6%82%e4%bd%95%e5%9c%a8ubuntu-22-04%e4%b8%8a%e4%bd%bf%e7%94%a8docker%e5%92%8cnginx%e9%83%a8%e7%bd%b2go-web%e5%ba%94%e7%94%a8%e7%a8%8b%e5%ba%8f%e3%80%82\/#local-main-organization-logo","url":"","contentUrl":"","caption":"Blog - Silicon Cloud"}]}},"_links":{"self":[{"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/posts\/99","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/users\/8"}],"replies":[{"embeddable":true,"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/comments?post=99"}],"version-history":[{"count":5,"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/posts\/99\/revisions"}],"predecessor-version":[{"id":109568,"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/posts\/99\/revisions\/109568"}],"wp:attachment":[{"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/media?parent=99"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/categories?post=99"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/tags?post=99"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}