{"id":901,"date":"2023-01-11T02:49:13","date_gmt":"2024-02-04T11:36:13","guid":{"rendered":"https:\/\/www.silicloud.com\/zh\/blog\/index.php\/2023\/11\/30\/%e5%a6%82%e4%bd%95%e5%9c%a8ubuntu-20-04%e4%b8%8a%e5%ae%89%e8%a3%85mastodon\/"},"modified":"2025-08-03T16:41:47","modified_gmt":"2025-08-03T08:41:47","slug":"%e5%a6%82%e4%bd%95%e5%9c%a8ubuntu-20-04%e4%b8%8a%e5%ae%89%e8%a3%85mastodon","status":"publish","type":"post","link":"https:\/\/www.silicloud.com\/zh\/blog\/%e5%a6%82%e4%bd%95%e5%9c%a8ubuntu-20-04%e4%b8%8a%e5%ae%89%e8%a3%85mastodon\/","title":{"rendered":"2023\u5b8c\u6574\u6559\u7a0b\uff1a\u5728Ubuntu 20.04\u4e0a\u8f7b\u677e\u5b89\u88c5Mastodon\u793e\u4ea4\u7f51\u7edc\u5e73\u53f0"},"content":{"rendered":"<h3>\u7b80\u4ecb<\/h3>\n<p>Mastodon\uff08\u957f\u6bdb\u8c61\uff09\u662f\u4e00\u6b3e\u57fa\u4e8e\u53bb\u4e2d\u5fc3\u5316\u6a21\u5f0f\u7684\u5fae\u535a\u793e\u4ea4\u5e94\u7528\uff0c\u4e5f\u88ab\u79f0\u4e3a\u8054\u90a6\u7f51\u7edc\u3002Mastodon\u662f\u5f00\u6e90\u7684\uff0c\u53ef\u4ee5\u7531\u4efb\u4f55\u4eba\u90e8\u7f72\u5728\u4efb\u4f55\u670d\u52a1\u5668\u4e0a\uff0c\u6bcf\u4e2a\u670d\u52a1\u5668\u90fd\u662f\u72ec\u7acb\u7684\u5b9e\u4f8b\u3002\u6bcf\u4e2a\u5b9e\u4f8b\u53ef\u4ee5\u62e5\u6709\u81ea\u5df1\u7684\u7b56\u7565\u548c\u7ba1\u7406\u673a\u5236\u3002\u5728\u6240\u6709Mastodon\u670d\u52a1\u5668\u7684\u8054\u90a6\u7f51\u7edc\u4e2d\uff0c\u6bcf\u4e2aMastodon\u5b9e\u4f8b\u90fd\u53ef\u4ee5\u76f8\u4e92\u611f\u77e5\u5176\u4ed6\u5b9e\u4f8b\u3002\u8fd9\u4f7f\u5f97\u7528\u6237\u53ef\u4ee5\u5728\u5355\u4e2a\u670d\u52a1\u5668\u5185\u4ee5\u53ca\u8de8\u591a\u4e2a\u5b9e\u4f8b\u4e0e\u5176\u4ed6\u7528\u6237\u8fdb\u884c\u4e92\u52a8\u3002<\/p>\n<p>\u5728\u672c\u6559\u7a0b\u4e2d\uff0c\u60a8\u5c06\u5b89\u88c5\u6700\u65b0\u7248\u672c\u7684Mastodon\uff0c\u76ee\u524d\u7248\u672c\u662f4.0.2\u3002\u60a8\u5c06\u914d\u7f6e\u5b98\u65b9\u7684Mastodon\u5b89\u88c5\u5b58\u50a8\u5e93\uff0c\u5e76\u8bbe\u7f6e\u73af\u5883\u4ee5\u5b89\u88c5\u6240\u6709\u5176\u4ed6\u4f9d\u8d56\u9879\u3002\u4f7f\u7528\u4ea4\u4e92\u5f0f\u8bbe\u7f6e\uff0c\u60a8\u5c06\u4e3a\u5b58\u50a8\u3001\u7535\u5b50\u90ae\u4ef6\u3001\u8d44\u6e90\u548c\u7ba1\u7406\u5458\u5e10\u6237\u8bbe\u7f6e\u81ea\u5b9a\u4e49\u7684Mastodon\u5b9e\u4f8b\u3002\u6700\u540e\uff0c\u60a8\u5c06\u901a\u8fc7\u4f7f\u7528Let&#8217;s Encrypt\u7684SSL\/TLS\u8bc1\u4e66\u4fdd\u62a4\u60a8\u7684\u5b9e\u4f8b\u3002<\/p>\n<div class=\"post-conf-note\">\n<p class=\"post-conf-desc\">\u6ce8\u610f\uff1a\u672c\u6559\u7a0b\u8be6\u7ec6\u8bf4\u660e\u4e86\u5728\u88f8\u91d1\u5c5e\u670d\u52a1\u5668\u4e0a\u8fdb\u884c\u5b89\u88c5\uff0c\u8fd9\u662fMastodon\u56e2\u961f\u63a8\u8350\u7684\u65b9\u6cd5\u3002\u60a8\u8fd8\u53ef\u4ee5\u8003\u8651\u4ee5\u4e0b\u5907\u9009Mastodon\u5b89\u88c5\u65b9\u6cd5\uff1a<\/p>\n<p>\u5728\u6211\u4eec\u7684\u5e02\u573a\u4e0a\u63d0\u4f9b\u76841-Click\u89e3\u51b3\u65b9\u6848\u3002\u60a8\u53ef\u4ee5\u6309\u7167\u6211\u4eec\u7684\u6559\u7a0b\u300a\u5982\u4f55\u4f7f\u7528Silicon Cloud Marketplace 1-Click\u5b89\u88c5Mastodon\u300b\u5f00\u59cb\u64cd\u4f5c\u3002<\/p>\n<\/div>\n<h2>\u5148\u51b3\u6761\u4ef6<\/h2>\n<p>\u8981\u8ddf\u7740\u8fd9\u4e2a\u6559\u7a0b\uff0c\u4f60\u9700\u8981\u51c6\u5907\uff1a<\/p>\n<ul class=\"post-ul\">\n<li>\u4e00\u53f0\u5b89\u88c5\u4e86Ubuntu 20.04\u7684\u670d\u52a1\u5668\uff0c\u914d\u7f6e\u4e86\u5177\u6709sudo\u6743\u9650\u7684\u975eroot\u7528\u6237\u548c\u9632\u706b\u5899\u3002\u60a8\u53ef\u4ee5\u6309\u7167\u6211\u4eec\u7684\u300aUbuntu 20.04\u521d\u59cb\u670d\u52a1\u5668\u8bbe\u7f6e\u300b\u6559\u7a0b\u8fdb\u884c\u8bbe\u7f6e\u3002<\/li>\n<li>\u5728\u60a8\u7684\u670d\u52a1\u5668\u4e0a\u5b89\u88c5\u4e86PostgreSQL\uff0c\u6309\u7167\u6211\u4eec\u7684\u300a\u5982\u4f55\u5728Ubuntu 20.04\u4e0a\u5b89\u88c5\u548c\u4f7f\u7528PostgreSQL\u300b\u6307\u5357\u7684\u7b2c1\u6b65\u64cd\u4f5c\u3002<\/li>\n<li>\u5728\u60a8\u7684\u670d\u52a1\u5668\u4e0a\u5b89\u88c5\u4e86Node.js 16.xx\u7248\u672c\u3002\u4f7f\u7528\u6211\u4eec\u7684\u300a\u5982\u4f55\u5728Ubuntu 20.04\u4e0a\u5b89\u88c5Node.js\u300b\u6559\u7a0b\u4e2d\u7684\u9009\u98792\u3002<\/li>\n<li>\u5728\u60a8\u7684\u670d\u52a1\u5668\u4e0a\u5b89\u88c5\u4e86Nginx\uff0c\u6309\u7167\u6211\u4eec\u7684\u300a\u5982\u4f55\u5728Ubuntu 20.04\u4e0a\u5b89\u88c5Nginx\u300b\u6559\u7a0b\u7684\u7b2c1\u6b65\u64cd\u4f5c\u3002<\/li>\n<li>\u4e00\u4e2a\u5df2\u6ce8\u518c\u7684\u57df\u540d\u3002\u672c\u6559\u7a0b\u901a\u7bc7\u4f7f\u7528your_domain\u4f5c\u4e3a\u793a\u4f8b\u3002\u60a8\u53ef\u4ee5\u5728Freenom\u514d\u8d39\u83b7\u53d6\u4e00\u4e2a\uff0c\u6216\u4f7f\u7528\u60a8\u9009\u62e9\u7684\u57df\u540d\u6ce8\u518c\u5546\u3002<\/li>\n<li>\u4e00\u6761A DNS\u8bb0\u5f55\uff0c\u5c06your_domain\u6307\u5411\u60a8\u670d\u52a1\u5668\u7684\u516c\u7f51IP\u5730\u5740\u3002\u60a8\u53ef\u4ee5\u4f7f\u7528Silicon Cloud\u8d26\u6237\u7ba1\u7406\u60a8\u7684\u57df\u540d\u548cDNS\u8bb0\u5f55\u3002<\/li>\n<\/ul>\n<p>\u4e00\u65e6\u4f60\u8bbe\u7f6e\u597d\u4e86\u4e00\u5207\uff0c\u5c31\u51c6\u5907\u597d\u5f00\u59cb\u7b2c\u4e00\u6b65\u3002<\/p>\n<h2>\u7b2c\u4e00\u6b65 &#8211; \u521b\u5efa\u4e00\u4e2aMastodon\u7cfb\u7edf\u7528\u6237\u548cPostgreSQL\u89d2\u8272<\/h2>\n<p>Mastodon\u7684\u6e90\u7801\u5047\u5b9a\u60a8\u7684\u670d\u52a1\u5668\u5c06\u4ee5\u4e00\u4e2a\u7279\u5b9a\u7684\u7cfb\u7edf\u7528\u6237mastodon\u6765\u8fdb\u884c\u7ba1\u7406\u3002\u8fd9\u4e2a\u8bbe\u5b9a\u76ee\u524d\u5728Mastodon\u7684\u8bb8\u591a\u90e8\u5206\u4e2d\u90fd\u662f\u786c\u7f16\u7801\u7684\u3002\u672c\u6559\u7a0b\u5c06\u5efa\u8bae\u6309\u7167\u8981\u6c42\u6765\u5efa\u7acb\u5e76\u4f7f\u7528mastodon\u7528\u6237\uff0c\u65e0\u8bba\u662f\u5728\u7cfb\u7edf\u5c42\u9762\u8fd8\u662f\u4f5c\u4e3aPostgreSQL\u6570\u636e\u5e93\u7684\u89d2\u8272\u3002<\/p>\n<p>\u672c\u6559\u7a0b\u5047\u8bbe\u60a8\u5728\u5148\u51b3\u6761\u4ef6\u7684\u521d\u59cb\u670d\u52a1\u5668\u8bbe\u7f6e\u4e2d\u521b\u5efa\u4e86\u4e00\u4e2a\u7528\u6237\uff0c\u4f46\u4ee5\u4e0b\u547d\u4ee4\u4e5f\u53ef\u4ee5\u4f5c\u4e3aroot\u7528\u6237\u8fd0\u884c\uff0c\u53ea\u9700\u5728\u547d\u4ee4\u524d\u5ffd\u7565sudo\u3002\u9996\u5148\uff0c\u4f7f\u7528adduser\u547d\u4ee4\u521b\u5efa\u60a8\u7684mastodon\u7528\u6237\uff1a<\/p>\n<div class=\"code-container\">\n<pre class=\"post-pre\"><code>sudo adduser mastodon<\/code><\/pre>\n<\/div>\n<p>\u63a5\u4e0b\u6765\uff0c\u5c06\u4f60\u7684Mastodon\u7528\u6237\u6dfb\u52a0\u5230sudo\u7528\u6237\u7ec4\u4e2d\uff0c\u8d4b\u4e88\u5176\u7ba1\u7406\u6743\u9650\u3002<\/p>\n<div class=\"code-container\">\n<pre class=\"post-pre\"><code>sudo usermod -aG sudo mastodon<\/code><\/pre>\n<\/div>\n<p>\u5728\u60a8\u7684\u7cfb\u7edf\u7ea7mastodon\u7528\u6237\u521b\u5efa\u5b8c\u6210\u540e\uff0c\u5728\u6570\u636e\u5e93\u4e2d\u521b\u5efa\u4e00\u4e2a\u5339\u914d\u7684\u89d2\u8272\u3002PostgreSQL\u4f7f\u7528\u5bf9\u7b49\u8ba4\u8bc1\uff0c\u5c06\u521b\u5efa\u7684\u89d2\u8272\u4e0e\u5339\u914d\u7684\u7cfb\u7edf\u7528\u6237\u76f8\u5173\u8054\u3002\u521b\u5efa\u4e00\u4e2a\u4e0emastodon\u540d\u5b57\u76f8\u5339\u914d\u7684\u7528\u6237\u3002<\/p>\n<div class=\"code-container\">\n<pre class=\"post-pre\"><code>sudo -u postgres createuser --interactive<\/code><\/pre>\n<\/div>\n<p>\u5728\u60a8\u9009\u62e9\u540d\u4e3a&#8221;mastodon&#8221;\u7684\u65b0\u89d2\u8272\u65f6\uff0c\u4ea4\u4e92\u5f0f\u6807\u5fd7\u5c06\u663e\u793a\u4ee5\u4e0b\u63d0\u793a\u3002\u8bf7\u786e\u4fdd\u8f93\u5165y\uff0c\u4ee5\u4f7f\u60a8\u7684\u65b0\u89d2\u8272\u6210\u4e3a\u8d85\u7ea7\u7528\u6237\uff1a<\/p>\n<div class=\"secondary-code-label\" title=\"\u8f93\u51fa\">\u8f93\u51fa<\/div>\n<div class=\"code-container\">\n<pre class=\"post-pre\"><code>Enter name of role to add: mastodon\r\nShall the new role be a superuser? (y\/n) y<\/code><\/pre>\n<\/div>\n<p>\u73b0\u5728\u4f60\u53ef\u4ee5\u767b\u5f55\u4f60\u65b0\u521b\u5efa\u7684Mastodon\u7528\u6237\u4e86\u3002<\/p>\n<div class=\"code-container\">\n<pre class=\"post-pre\"><code>su - mastodon<\/code><\/pre>\n<\/div>\n<p>\u5728\u672c\u6559\u7a0b\u7684\u5176\u4f59\u90e8\u5206\u4e2d\uff0c\u60a8\u5c06\u4ee5\u8fd9\u4e2aMastodon\u7528\u6237\u8eab\u4efd\u8fd0\u884c\u6240\u6709\u547d\u4ee4\u3002<\/p>\n<h2>\u7b2c\u4e8c\u6b65 &#8211; \u5b89\u88c5\u4f9d\u8d56\u9879\u548c\u514b\u9686Mastodon<\/h2>\n<p>\u5927\u591a\u6570Mastodon\u7684\u914d\u7f6e\u901a\u8fc7\u540e\u7eed\u6b65\u9aa4\u4e2d\u7684\u4ea4\u4e92\u5f0f\u8bbe\u7f6e\u6765\u5904\u7406\u3002\u9996\u5148\uff0c\u60a8\u9700\u8981\u5b89\u88c5\u5176\u4f9d\u8d56\u9879\u3002Mastodon\u662f\u4e00\u4e2a\u4e25\u91cd\u4f9d\u8d56\u4e8eRuby\u548cNode.js\u7684\u9879\u76ee\uff0c\u540c\u65f6\u5728Linux\u73af\u5883\u4e2d\u8fd0\u884c\uff0c\u56e0\u6b64\u9700\u8981\u4e09\u4e2a\u8f6f\u4ef6\u5305\u7ba1\u7406\u5668\uff1aLinux\u7cfb\u7edf\u7ea7\u522b\u7684APT\uff0cRuby\u5b9d\u77f3\u7684Bundler\u548cNode.js\u8f6f\u4ef6\u5305\u7684Yarn\u3002\u8981\u4ece\u6e90\u4ee3\u7801\u8fdb\u884c\u5b89\u88c5\uff0c\u60a8\u9700\u8981\u514b\u9686Mastodon\u5b58\u50a8\u5e93\u3002\u8be5\u8fc7\u7a0b\u5c06\u6309\u7167\u4ee5\u4e0b\u987a\u5e8f\u8fdb\u884c\uff1a<\/p>\n<ul class=\"post-ul\">\n<li>Install APT dependencies.<\/li>\n<li>Clone Mastodon from source.<\/li>\n<li>Install Ruby and Mastodon\u2019s Ruby dependencies.<\/li>\n<li>Install Node.js dependencies.<\/li>\n<\/ul>\n<p>\u7b2c\u4e00\u6b65\u662f\u901a\u8fc7apt\u5b89\u88c5\u4f9d\u8d56\u9879\uff0c\u5176\u4e2d\u5305\u62ec\uff1aRedis\u4f5c\u4e3a\u952e\u503c\u5b58\u50a8\u6570\u636e\u5e93\u3001Certbot\u7528\u4e8e\u5904\u7406TLS\/SSL\u52a0\u5bc6\u4ee5\u53ca\u7528\u4e8e\u6784\u5efa\u3001\u7f16\u8bd1\u548c\u56fe\u50cf\u5904\u7406\u7684\u5176\u4ed6\u5e93\u3002\u8981\u5b89\u88c5\u8fd9\u4e9b\u4f9d\u8d56\u9879\uff0c\u8bf7\u4f7f\u7528apt update\u547d\u4ee4\u6765\u66f4\u65b0\u60a8\u7684\u8f6f\u4ef6\u5305\u7d22\u5f15\u3002<\/p>\n<pre class=\"post-pre\"><code><\/code><\/pre>\n<ol>\n<li data-prefix=\"$\"><span class=\"token function\">sudo<\/span> <span class=\"token function\">apt<\/span> update<\/li>\n<\/ol>\n<pre class=\"post-pre\"><code><\/code><\/pre>\n<p>&nbsp;<\/p>\n<pre class=\"post-pre\"><code><\/code><\/pre>\n<p>\u7136\u540e\u4f7f\u7528apt install\u547d\u4ee4\u5b89\u88c5\u8f6f\u4ef6\u5305\u3002<\/p>\n<pre class=\"post-pre\"><code><\/code><\/pre>\n<ol>\n<li data-prefix=\"$\"><span class=\"token function\">sudo<\/span> <span class=\"token function\">apt<\/span> <span class=\"token function\">install<\/span> <span class=\"token punctuation\">\\<\/span><\/li>\n<li data-prefix=\"$\">imagemagick ffmpeg libpq-dev libxml2-dev libxslt1-dev <span class=\"token punctuation\">\\<\/span><\/li>\n<li data-prefix=\"$\">libprotobuf-dev protobuf-compiler pkg-config <span class=\"token punctuation\">\\<\/span><\/li>\n<li data-prefix=\"$\">redis-server redis-tools <span class=\"token punctuation\">\\<\/span><\/li>\n<li data-prefix=\"$\">certbot python3-certbot-nginx libidn11-dev libicu-dev libjemalloc-dev<\/li>\n<\/ol>\n<pre class=\"post-pre\"><code><\/code><\/pre>\n<p>&nbsp;<\/p>\n<pre class=\"post-pre\"><code><\/code><\/pre>\n<h3>\u514b\u9686\u731b\u72b8\u8c61\u73b0\u5728\u4f60\u7684\u670d\u52a1\u5668\u5df2\u7ecf\u51c6\u5907\u597d\u4ece\u5b98\u65b9\u4ed3\u5e93\u4e2d\u514b\u9686Mastodon\u6e90\u4ee3\u7801\u3002\u5982\u524d\u6240\u8ff0\uff0c\u672c\u6559\u7a0b\u5c06\u4f7f\u7528\u6700\u65b0\u7248\u672c\u7684Mastodon\uff0c\u4e5f\u5c31\u662fv4.0.2\uff0c\u4ee5\u83b7\u53d6\u6700\u65b0\u7684\u529f\u80fd\u3001\u5b89\u5168\u6027\u548c\u9519\u8bef\u4fee\u590d\u3002<\/p>\n<p>\u9996\u5148\uff0c\u5c06 Mastodon \u4ed3\u5e93\u514b\u9686\u5230\u4f60\u7684\u670d\u52a1\u5668\u4e0a\uff0c\u5b58\u653e\u5728\u540d\u4e3a live \u7684\u65b0\u76ee\u5f55\u4e2d\u3002<\/p>\n<pre class=\"post-pre\"><code><\/code><\/pre>\n<ol>\n<li data-prefix=\"$\"><span class=\"token function\">git<\/span> clone https:\/\/github.com\/mastodon\/mastodon.git live<\/li>\n<\/ol>\n<pre class=\"post-pre\"><code><\/code><\/pre>\n<p>&nbsp;<\/p>\n<pre class=\"post-pre\"><code><\/code><\/pre>\n<p>\u8fd9\u4e2a\u76ee\u5f55\u547d\u540d\u7ea6\u5b9a\u5728Mastodon\u7684\u6587\u6863\u4e2d\u5e7f\u6cdb\u4f7f\u7528\uff0c\u5e76\u5efa\u8bae\u4e3a\u4e86\u4e00\u81f4\u6027\u800c\u4f7f\u7528\u3002\u63a5\u4e0b\u6765\uff0c\u8fdb\u5165\u60a8\u521b\u5efa\u7684\u76ee\u5f55\uff0c\u6ce8\u610f\u8fd9\u5c06\u6210\u4e3a\u672c\u6559\u7a0b\u7684\u9879\u76ee\u76ee\u5f55\u3002<\/p>\n<pre class=\"post-pre\"><code><\/code><\/pre>\n<ol>\n<li data-prefix=\"$\"><span class=\"token builtin class-name\">cd<\/span> live<\/li>\n<\/ol>\n<pre class=\"post-pre\"><code><\/code><\/pre>\n<p>&nbsp;<\/p>\n<pre class=\"post-pre\"><code><\/code><\/pre>\n<p>\u73b0\u5728\u4f60\u53ef\u4ee5\u4f7f\u7528git\u6765\u67e5\u770b\u6700\u65b0\u7684\u7248\u672cv4.0.2\u3002<\/p>\n<pre class=\"post-pre\"><code><\/code><\/pre>\n<ol>\n<li data-prefix=\"$\"><span class=\"token function\">git<\/span> checkout <mark>v4.0.2<\/mark><\/li>\n<\/ol>\n<pre class=\"post-pre\"><code><\/code><\/pre>\n<p>&nbsp;<\/p>\n<pre class=\"post-pre\"><code><\/code><\/pre>\n<h3>\u5b89\u88c5Ruby\u548cMastodon\u7684Ruby\u4f9d\u8d56\u7ec4\u4ef6\u5b89\u88c5\u597dMastodon\u6e90\u4ee3\u7801\u540e\uff0c\u4f60\u73b0\u5728\u53ef\u4ee5\u7ee7\u7eed\u5b89\u88c5Ruby\u548cMastodon\u7684Ruby\u4f9d\u8d56\u9879\u3002\u4f60\u5c06\u5b89\u88c5rbenv\uff0c\u8fd9\u662f\u4f60\u7528\u6765\u5b89\u88c5Ruby\u7f16\u7a0b\u8bed\u8a00\u7684\u7248\u672c\u7ba1\u7406\u5de5\u5177\u3002\u7531\u4e8erbenv\u662f\u5728\u7528\u6237\u7ea7\u522b\u800c\u4e0d\u662f\u7cfb\u7edf\u7ea7\u522b\u5b89\u88c5\u7684\uff0c\u6240\u4ee5\u5728\u521b\u5efa\u5e76\u5207\u6362\u5230\u4f60\u7684mastodon\u7528\u6237\u4e4b\u540e\u5fc5\u987b\u5728\u8fd9\u91cc\u5b8c\u6210\u6b64\u6b65\u9aa4\u3002\u4f60\u5c06\u5b89\u88c5Ruby\u7248\u672c3.0.4\uff0c\u6309\u7167\u6211\u4eec\u7684\u6559\u7a0b\u300a\u5982\u4f55\u5728Ubuntu 20.04\u4e0a\u4f7f\u7528rbenv\u5b89\u88c5Ruby on Rails\u300b\u7684\u6b65\u9aa41\u81f33\u8fdb\u884c\u64cd\u4f5c\u3002\u867d\u7136\u7b2c2\u6b65\u4e2d\u6ca1\u6709\u660e\u786e\u5217\u51fa3.0.4\u7248\u672c\u4f5c\u4e3a\u9009\u9879\uff0c\u4f46\u5982\u679c\u4f60\u5728\u5b89\u88c5\u547d\u4ee4\u4e2d\u6307\u5b9a\u8be5\u7248\u672c\uff0c\u5b83\u4ecd\u7136\u53ef\u4ee5\u6b63\u5e38\u5de5\u4f5c\u3002\u8bf7\u8bb0\u4f4f\uff0c\u5c3d\u7ba1\u8fd9\u4e2a\u6559\u7a0b\u662f\u5173\u4e8eRuby on Rails\u7684\uff0c\u4f46\u4f60\u53ea\u9700\u6309\u7167\u5b89\u88c5Ruby\u548crbenv\u7684\u6b65\u9aa4\u8fdb\u884c\u64cd\u4f5c\u3002<\/p>\n<p>Ruby\u7684\u4f9d\u8d56\u7531Bundler\u8fdb\u884c\u7ba1\u7406\u3002Bundler\u5b89\u88c5\u4e86Mastodon\u6240\u9700\u7684\u6240\u6709Ruby\u5b9d\u77f3\uff0c\u4f46\u9996\u5148\u60a8\u9700\u8981\u914d\u7f6e\u5b83\u4ee5\u4fbf\u8003\u8651\u751f\u4ea7\u73af\u5883\u5b89\u88c5\u3002<\/p>\n<p>\u4f7f\u7528Bundler\u7684\u6346\u7ed1\u914d\u7f6e\u547d\u4ee4\u4e0e\u5176\u914d\u7f6e\u7cfb\u7edf\u8fdb\u884c\u4ea4\u4e92\u3002\u4f7f\u7528\u5b83\u5c06\u90e8\u7f72\u8bbe\u7f6e\u4e3atrue\u3002<\/p>\n<pre class=\"post-pre\"><code><\/code><\/pre>\n<ol>\n<li data-prefix=\"$\">bundle config deployment <span class=\"token string\">&#8216;true&#8217;<\/span><\/li>\n<\/ol>\n<pre class=\"post-pre\"><code><\/code><\/pre>\n<p>&nbsp;<\/p>\n<pre class=\"post-pre\"><code><\/code><\/pre>\n<p>\u63a5\u4e0b\u6765\uff0c\u4f7f\u7528\u201cwithout\u201d\u6765\u786e\u4fdd\u5728\u5f00\u53d1\u548c\u6d4b\u8bd5\u8fc7\u7a0b\u4e2d\u4e0d\u4f1a\u5b89\u88c5\u4f9d\u8d56\u9879\u3002<\/p>\n<pre class=\"post-pre\"><code><\/code><\/pre>\n<ol>\n<li data-prefix=\"$\">bundle config without <span class=\"token string\">&#8216;development test&#8217;<\/span><\/li>\n<\/ol>\n<pre class=\"post-pre\"><code><\/code><\/pre>\n<p>&nbsp;<\/p>\n<pre class=\"post-pre\"><code><\/code><\/pre>\n<p>\u73b0\u5728\u4f60\u53ef\u4ee5\u4f7f\u7528\u5b89\u88c5\u547d\u4ee4\u5b89\u88c5Ruby\u7684\u4f9d\u8d56\u3002\u8fd9\u53ef\u80fd\u9700\u8981\u4e00\u4e9b\u65f6\u95f4\uff0c\u6709\u51e0\u6b21\u4f1a\u6709\u6682\u505c\uff0c\u4f46\u8fd9\u662f\u6b63\u5e38\u7684\u884c\u4e3a\u3002<\/p>\n<pre class=\"post-pre\"><code><\/code><\/pre>\n<ol>\n<li data-prefix=\"$\">bundle <span class=\"token function\">install<\/span><\/li>\n<\/ol>\n<pre class=\"post-pre\"><code><\/code><\/pre>\n<p>&nbsp;<\/p>\n<pre class=\"post-pre\"><code><\/code><\/pre>\n<pre class=\"post-pre\"><code><\/code><\/pre>\n<div class=\"secondary-code-label\" title=\"Output\">Output<\/p>\n<pre class=\"post-pre\"><code><\/code><\/pre>\n<p>Fetching gem metadata from https:\/\/rubygems.org\/&#8230;&#8230;&#8230; Fetching https:\/\/github.com\/ClearlyClaire\/webpush.git Fetching rake 13.0.6 Installing rake 13.0.6 Fetching concurrent-ruby 1.1.10 Installing concurrent-ruby 1.1.10 . . .<\/p>\n<pre class=\"post-pre\"><code><\/code><\/pre>\n<p>\u4e00\u65e6\u5b8c\u6210\uff0c\u6700\u540e\u4f1a\u6709\u5f88\u591a\u8f93\u51fa\uff0c\u770b\u8d77\u6765\u4f3c\u4e4e\u9700\u8981\u91c7\u53d6\u884c\u52a8\u3002\u7136\u800c\uff0c\u4f60\u53ef\u4ee5\u5b89\u5168\u5730\u7ee7\u7eed\u8fdb\u884c\uff0c\u65e0\u9700\u989d\u5916\u884c\u52a8\u3002<\/p>\n<h3>\u5b89\u88c5Mastodon\u7684JavaScript\u4f9d\u8d56<\/p>\n<p>\u4e00\u65e6Mastodon\u7684Ruby\u4f9d\u8d56\u5b8c\u6210\u5b89\u88c5\uff0c\u60a8\u53ef\u4ee5\u5f00\u59cb\u5b89\u88c5JavaScript\u4f9d\u8d56\u9879\u3002Mastodon\u4f7f\u7528yarn\u6765\u7ba1\u7406\u548c\u5b89\u88c5JavaScript\u5305\uff0c\u800c\u4e0d\u662fnpm\u3002\u5bf9\u4e8eNode.js\u7248\u672c16.10\u53ca\u4ee5\u4e0a\u7684\u5b89\u88c5\uff0cyarn\u9ed8\u8ba4\u901a\u8fc7corepack\u53ef\u7528\u3002<\/p>\n<p>\u8981\u8bbf\u95eeyarn\uff0c\u8bf7\u542f\u7528Node.js\u9644\u5e26\u7684\u6838\u5fc3\u5305\uff08corepack\uff09\u3002<\/p>\n<pre class=\"post-pre\"><code><\/code><\/pre>\n<ol>\n<li data-prefix=\"$\"><span class=\"token function\">sudo<\/span> corepack <span class=\"token builtin class-name\">enable<\/span><\/li>\n<\/ol>\n<pre class=\"post-pre\"><code><\/code><\/pre>\n<p>&nbsp;<\/p>\n<pre class=\"post-pre\"><code><\/code><\/pre>\n<p>Yarn\u5728\u51761.0\u7248\u672c\uff08\u4e5f\u79f0\u4e3a\u7ecf\u5178\u7248\uff09\u548c2.0\u7248\u672c\u4e4b\u95f4\u6709\u7740\u4e0d\u540c\u7684\u53d1\u5c55\u5386\u53f2\u3002Mastodon\u9700\u8981\u7ecf\u5178\u7248\u7684Yarn\uff0c\u60a8\u53ef\u4ee5\u901a\u8fc7yarn set version\u547d\u4ee4\u6765\u542f\u7528\u5b83\u3002<\/p>\n<pre class=\"post-pre\"><code><\/code><\/pre>\n<ol>\n<li data-prefix=\"$\"><span class=\"token function\">yarn<\/span> <span class=\"token builtin class-name\">set<\/span> version classic<\/li>\n<\/ol>\n<pre class=\"post-pre\"><code><\/code><\/pre>\n<p>&nbsp;<\/p>\n<pre class=\"post-pre\"><code><\/code><\/pre>\n<p>\u73b0\u5728\u60a8\u53ef\u4ee5\u4f7f\u7528yarn install\u5b89\u88c5Mastodon\u7684JavaScript\u4f9d\u8d56\u3002\u8fd9\u4e2a\u989d\u5916\u7684\u6807\u5fd7\u53ef\u4ee5\u786e\u4fdd\u4e0d\u751f\u6210yarn.lock\u6587\u4ef6\u3002<\/p>\n<pre class=\"post-pre\"><code><\/code><\/pre>\n<ol>\n<li data-prefix=\"$\"><span class=\"token function\">yarn<\/span> <span class=\"token function\">install<\/span> &#8211;pure-lockfile<\/li>\n<\/ol>\n<pre class=\"post-pre\"><code><\/code><\/pre>\n<p>&nbsp;<\/p>\n<pre class=\"post-pre\"><code><\/code><\/pre>\n<pre class=\"post-pre\"><code><\/code><\/pre>\n<div class=\"secondary-code-label\" title=\"\u8f93\u51fa\">\u8f93\u51fa<\/p>\n<pre class=\"post-pre\"><code><\/code><\/pre>\n<p>yarn install v1.22.19 [1\/6] \u6b63\u5728\u9a8c\u8bc1package.json&#8230; [2\/6] \u6b63\u5728\u89e3\u6790\u5305&#8230; [3\/6] \u6b63\u5728\u83b7\u53d6\u5305&#8230; [4\/6] \u6b63\u5728\u94fe\u63a5\u4f9d\u8d56\u9879&#8230; \u8b66\u544a\uff1a\u5de5\u4f5c\u533a\u53ea\u80fd\u5728\u79c1\u6709\u9879\u76ee\u4e2d\u542f\u7528\u3002 [5\/6] \u6b63\u5728\u6784\u5efa\u65b0\u5305&#8230; [6\/6] \u6b63\u5728\u6e05\u7406\u6a21\u5757&#8230; \u5b8c\u6210\uff0c\u8017\u65f650.84\u79d2\u3002<\/p>\n<pre class=\"post-pre\"><code><\/code><\/pre>\n<p>\u73b0\u5728\u60a8\u5df2\u7ecf\u51c6\u5907\u597d\u4e3a\u60a8\u7684\u670d\u52a1\u5668\u521b\u5efa\u4e00\u4e2a\u81ea\u5b9a\u4e49\u7684Mastodon\u914d\u7f6e\u6587\u4ef6\u4e86\u3002<\/p>\n<h2>\u7b2c\u4e09\u6b65 &#8211; \u901a\u8fc7\u4ea4\u4e92\u5f0f\u8bbe\u7f6e\u751f\u6210Mastodon\u914d\u7f6e\u6587\u4ef6<\/h2>\n<p>Mastodon\u4f7f\u7528\u4e00\u79cd\u540d\u4e3a.env\u6587\u4ef6\u7684\u914d\u7f6e\u6587\u4ef6\u7684\u53d8\u79cd\u3002\u5728~\/live\/.env.production.sample\u8def\u5f84\u4e0b\u6709\u4e00\u4e2a\u6837\u672c\u6587\u4ef6\u53ef\u4f9b\u67e5\u770b\uff0c\u4f46\u60a8\u4e0d\u9700\u8981\u590d\u5236\u8be5\u6587\u4ef6\uff0c\u800c\u662f\u4f7f\u7528\u4ea4\u4e92\u5f0f\u8bbe\u7f6e\u8fc7\u7a0b\u3002\u7ed3\u675f\u540e\uff0c\u5c06\u5728~\/live\/.env.production\u751f\u6210\u4e00\u4e2a\u81ea\u5b9a\u4e49\u6587\u4ef6\u3002\u6b64\u4ea4\u4e92\u5f0f\u8bbe\u7f6e\u5c06\u6db5\u76d6\u57fa\u672c\u670d\u52a1\u5668\u4fe1\u606f\uff0c\u5efa\u7acbPostgreSQL\u548cRedis\u8fde\u63a5\uff0c\u8bbe\u7f6e\u4e91\u5b58\u50a8\u548c\u7535\u5b50\u90ae\u4ef6\u5904\u7406\uff0c\u7f16\u8bd1CSS\u548cJavaScript\u8d44\u6e90\uff0c\u5e76\u5728Mastodon\u4e2d\u521b\u5efa\u4e00\u4e2a\u7ba1\u7406\u5458\u5e10\u6237\u3002<\/p>\n<p>\u5728\u5f00\u59cb\u591a\u6b65\u8bbe\u7f6e\u8fc7\u7a0b\u4e4b\u524d\uff0c\u8bf7\u786e\u4fdd\u60a8\u7684\u9632\u706b\u5899\u5141\u8bb8\u901a\u8fc7\u9002\u5f53\u7684\u7aef\u53e3\u53d1\u9001SMTP\u6d41\u91cf\u3002\u5b89\u5168TLS\u8fde\u63a5\u7684\u9ed8\u8ba4SMTP\u7aef\u53e3\u662f587\uff0c\u8fd9\u5c06\u5728\u7535\u5b50\u90ae\u4ef6\u8bbe\u7f6e\u90e8\u5206\u4e2d\u8fdb\u884c\u89e3\u91ca\u3002\u76ee\u524d\uff0c\u5141\u8bb8\u5728\u9632\u706b\u5899\u4e2d\u8bbf\u95ee\u6b64\u7aef\u53e3\u3002<\/p>\n<pre class=\"post-pre\"><code><\/code><\/pre>\n<ol>\n<li data-prefix=\"$\"><span class=\"token function\">sudo<\/span> ufw allow <span class=\"token number\">587<\/span><\/li>\n<\/ol>\n<pre class=\"post-pre\"><code><\/code><\/pre>\n<p>&nbsp;<\/p>\n<pre class=\"post-pre\"><code><\/code><\/pre>\n<p>\u4e3a\u4e86\u5f00\u59cb\u4ea4\u4e92\u5f0f\u8bbe\u7f6e\uff0c\u8bf7\u4f7f\u7528<code>bundle exec rake<\/code>\u6267\u884cMastodon\u7684\u8bbe\u7f6e\uff0c\u5e76\u540c\u65f6\u8bbe\u7f6e<code>production<\/code>\u73af\u5883\u53d8\u91cf\u3002<\/p>\n<pre class=\"post-pre\"><code><\/code><\/pre>\n<ol>\n<li data-prefix=\"$\"><span class=\"token assign-left variable\">RAILS_ENV<\/span><span class=\"token operator\">=<\/span>production bundle <span class=\"token builtin class-name\">exec<\/span> rake mastodon:setup<\/li>\n<\/ol>\n<pre class=\"post-pre\"><code><\/code><\/pre>\n<p>&nbsp;<\/p>\n<pre class=\"post-pre\"><code><\/code><\/pre>\n<p>\u8bf7\u8f93\u5165\u60a8\u7684\u57df\u540d\u3002\u8bf7\u6ce8\u610f\uff0c\u5728\u5b8c\u6210\u540e\u66f4\u6539\u6b64\u9879\u662f\u56f0\u96be\u7684\uff0c\u56e0\u6b64\u8bf7\u4ed4\u7ec6\u68c0\u67e5\u4ee5\u786e\u4fdd\u51c6\u786e\u65e0\u8bef\u3002<\/p>\n<pre class=\"post-pre\"><code><\/code><\/pre>\n<div class=\"secondary-code-label\" title=\"\u8f93\u51fa\">\u8f93\u51fa<\/p>\n<pre class=\"post-pre\"><code><\/code><\/pre>\n<p>\u60a8\u7684\u5b9e\u4f8b\u901a\u8fc7\u5176\u57df\u540d\u8fdb\u884c\u6807\u8bc6\u3002\u4e4b\u540e\u66f4\u6539\u5b83\u4f1a\u5bfc\u81f4\u95ee\u9898\u3002\u57df\u540d\uff1a<mark>\u60a8\u7684\u57df\u540d<\/mark><\/p>\n<pre class=\"post-pre\"><code><\/code><\/pre>\n<p>Mastodon\u6709\u4e00\u4e2a\u5355\u7528\u6237\u6a21\u5f0f\uff0c\u53ef\u4ee5\u7981\u7528\u6ce8\u518c\u529f\u80fd\u3002\u5982\u679c\u8981\u8bbe\u7f6e\u4e00\u4e2a\u4e0e\u4ed6\u4eba\u5171\u4eab\u7a7a\u95f4\u7684\u670d\u52a1\u5668\uff0c\u5e94\u8be5\u4e0d\u8981\u542f\u7528\u5355\u7528\u6237\u6a21\u5f0f\u3002<\/p>\n<pre class=\"post-pre\"><code><\/code><\/pre>\n<div class=\"secondary-code-label\" title=\"\u8f93\u51fa\">\u8f93\u51fa<\/p>\n<pre class=\"post-pre\"><code><\/code><\/pre>\n<p>\u5355\u7528\u6237\u6a21\u5f0f\u4f1a\u7981\u7528\u6ce8\u518c\u5e76\u5c06\u7740\u9646\u9875\u91cd\u5b9a\u5411\u5230\u60a8\u7684\u516c\u5f00\u4e2a\u4eba\u8d44\u6599\u3002\u60a8\u60f3\u542f\u7528\u5355\u7528\u6237\u6a21\u5f0f\u5417\uff1f<mark>\u5426<\/mark><\/p>\n<pre class=\"post-pre\"><code><\/code><\/pre>\n<p>\u56de\u7b54\u4e0d\u4f7f\u7528Docker\u7684\u63d0\u793a\uff0c\u56e0\u4e3a\u8be5\u6559\u7a0b\u4ecb\u7ecd\u7684\u662f\u5728\u88f8\u673a\u670d\u52a1\u5668\u4e0a\u8fdb\u884c\u5e38\u89c4\u5b89\u88c5\u3002<\/p>\n<pre class=\"post-pre\"><code><\/code><\/pre>\n<div class=\"secondary-code-label\" title=\"\u8f93\u51fa\">\u8f93\u51fa<\/p>\n<pre class=\"post-pre\"><code><\/code><\/pre>\n<p>\u60a8\u662f\u5426\u4f7f\u7528Docker\u6765\u8fd0\u884cMastodon\uff1f<mark>\u5426<\/mark><\/p>\n<pre class=\"post-pre\"><code><\/code><\/pre>\n<h3>\u914d\u7f6e\u6570\u636e\u5e93<\/h3>\n<p>\u6240\u6709\u7684PostgreSQL\u8bbe\u7f6e\u90fd\u53ef\u4ee5\u4fdd\u6301\u9ed8\u8ba4\u503c\uff0c\u53ea\u9700\u6309Enter\u952e\u8fdb\u884c\u6bcf\u4e2a\u63d0\u793a\u3002\u60a8\u7684\u6570\u636e\u5e93\u4e0d\u4f7f\u7528\u5bc6\u7801\u8fdb\u884c\u8eab\u4efd\u9a8c\u8bc1\uff0c\u800c\u662f\u4f7f\u7528\u5bf9\u7b49\u8eab\u4efd\u9a8c\u8bc1\uff0c\u7a0d\u540e\u4f1a\u8be6\u7ec6\u8ba8\u8bba\u3002\u6682\u65f6\u53ef\u4ee5\u5c06\u5176\u7559\u7a7a\u3002<\/p>\n<pre class=\"post-pre\"><code><\/code><\/pre>\n<div class=\"secondary-code-label\" title=\"\u8f93\u51fa\">\u8f93\u51fa<\/p>\n<pre class=\"post-pre\"><code><\/code><\/pre>\n<p>PostgreSQL\u4e3b\u673a\uff1a<mark>\/var\/run\/postgresql<\/mark><br \/>\nPostgreSQL\u7aef\u53e3\uff1a<mark>5432<\/mark><br \/>\nPostgreSQL\u6570\u636e\u5e93\u540d\u79f0\uff1a<mark>mastodon_production<\/mark><br \/>\nPostgreSQL\u7528\u6237\u540d\uff1a<mark>mastodon<\/mark><br \/>\nPostgreSQL\u7528\u6237\u5bc6\u7801\uff1a\u6570\u636e\u5e93\u914d\u7f6e\u6709\u6548\uff01<\/p>\n<pre class=\"post-pre\"><code><\/code><\/pre>\n<p>Redis\u7684\u8bbe\u7f6e\u4e5f\u53ef\u4ee5\u4fdd\u6301\u9ed8\u8ba4\u503c\uff0c\u5bc6\u7801\u5b57\u6bb5\u7559\u7a7a\u3002\u60a8\u4e0d\u9700\u8981\u8bbe\u7f6e\u5bc6\u7801\uff0c\u56e0\u4e3a\u8fd9\u4e2a\u6570\u636e\u5e93\u53ea\u80fd\u5728\u672c\u5730\u670d\u52a1\u5668\u4e0a\u8bbf\u95ee\u3002\u60a8\u53ef\u4ee5\u6309\u56de\u8f66\u952e\u6765\u786e\u8ba4\u6bcf\u4e2a\u63d0\u793a\u3002<\/p>\n<pre class=\"post-pre\"><code><\/code><\/pre>\n<div class=\"secondary-code-label\" title=\"\u8f93\u51fa\">\u8f93\u51fa<\/p>\n<pre class=\"post-pre\"><code><\/code><\/pre>\n<p>Redis\u4e3b\u673a\uff1a<mark>localhost<\/mark><br \/>\nRedis\u7aef\u53e3\uff1a<mark>6379<\/mark><br \/>\nRedis\u5bc6\u7801\uff1aRedis\u914d\u7f6e\u6709\u6548\uff01<\/p>\n<pre class=\"post-pre\"><code><\/code><\/pre>\n<p>\u5bf9\u4e24\u4e2a\u6570\u636e\u5e93\u7684\u8fde\u63a5\u5c06\u88ab\u6d4b\u8bd5\uff0c\u786e\u4fdd\u5176\u6b63\u5e38\u5de5\u4f5c\u3002<\/p>\n<h3>\u914d\u7f6e\u5b58\u50a8\u8bbe\u5907<\/h3>\n<h3>\u914d\u7f6e\u6587\u4ef6\u5b58\u50a8<\/h3>\n<p>\u63a5\u4e0b\u6765\uff0c\u4f60\u4f1a\u88ab\u8be2\u95ee\u5173\u4e8e\u5c06\u6587\u4ef6\u4e0a\u4f20\u5230\u4e91\u5b58\u50a8\u7684\u95ee\u9898\u3002Mastodon\u7684\u5b58\u50a8\u53ef\u4ee5\u901a\u8fc7\u672c\u5730\u5b58\u50a8\u6216\u901a\u8fc7\u591a\u4e2a\u4f9b\u5e94\u5546\u7684\u4e91\u5b58\u50a8\u6765\u8bbe\u7f6e\u3002\u5982\u679c\u4f60\u60f3\u4f7f\u7528\u672c\u5730\u5b58\u50a8\uff0c\u6216\u8005\u5982\u679c\u4f60\u6ca1\u6709\u73b0\u6210\u7684\u4e91\u5b58\u50a8\u89e3\u51b3\u65b9\u6848\uff0c\u56de\u7b54&#8221;\u5426&#8221;\u3002<\/p>\n<p>\u7136\u800c\uff0c\u8fd9\u5e76\u4e0d\u662f\u4e00\u4e2a\u6301\u4e45\u7684\u5b58\u50a8\u89e3\u51b3\u65b9\u6848\uff0c\u56e0\u6b64\u5efa\u8bae\u4f7f\u7528\u5bf9\u8c61\u5b58\u50a8\u89e3\u51b3\u65b9\u6848\u6765\u8fdb\u884c\u751f\u4ea7\u3002Mastodon\u652f\u6301\u51e0\u79cd\u6d41\u884c\u7684\u5bf9\u8c61\u5b58\u50a8\u89e3\u51b3\u65b9\u6848\uff0c\u5305\u62ecSilicon Cloud Spaces\u548cMinIO\u7b49S3\u517c\u5bb9\u7684\u89e3\u51b3\u65b9\u6848\u3002\u7531\u4e8eMinIO\u662f\u5f00\u6e90\u7684\uff0c\u60a8\u53ef\u4ee5\u6309\u7167\u6211\u4eec\u7684\u6559\u7a0b\u6765\u8bbe\u7f6e\u81ea\u5df1\u7684MinIO\u5bf9\u8c61\u5b58\u50a8\u670d\u52a1\u5668\u3002\u5728\u672c\u6559\u7a0b\u4e2d\uff0c\u60a8\u53ef\u4ee5\u9009\u62e9\u662f\uff0c\u5e76\u4f7f\u7528\u4e0b\u9762\u7684Silicon Cloud Spaces\u793a\u4f8b\u3002\u6709\u5173Spaces\u7684\u66f4\u591a\u8be6\u7ec6\u4fe1\u606f\uff0c\u8bf7\u53c2\u8003\u6211\u4eec\u7684\u6559\u7a0b\uff0c\u4e86\u89e3\u5982\u4f55\u521b\u5efa\u60a8\u81ea\u5df1\u7684Silicon Cloud Space\u548c\u8bbf\u95ee\u5bc6\u94a5\uff1a<\/p>\n<pre class=\"post-pre\"><code>\u60a8\u60f3\u8981\u5c06\u4e0a\u4f20\u7684\u6587\u4ef6\u5b58\u50a8\u5728\u4e91\u4e0a\u5417\uff1f \u662f\r\n\u63d0\u4f9b\u5546 <mark>Silicon Cloud Spaces<\/mark>\r\n\u7a7a\u95f4\u540d\u79f0\uff1a <mark>your_spaces_name<\/mark>\r\n\u7a7a\u95f4\u533a\u57df\uff1a <mark>your_spaces_region<\/mark>\r\n\u7a7a\u95f4\u7aef\u70b9\uff1a <mark>your_spaces_endpoint<\/mark>\r\n\u7a7a\u95f4\u8bbf\u95ee\u5bc6\u94a5\uff1a <mark>your_spaces_access_key<\/mark>\r\n\u7a7a\u95f4\u79d8\u5bc6\u5bc6\u94a5\uff1a <mark>your_spaces_secret_key<\/mark>\r\n\u60a8\u60f3\u8981\u4ece\u81ea\u5df1\u7684\u57df\u540d\u8bbf\u95ee\u4e0a\u4f20\u7684\u6587\u4ef6\u5417\uff1f <mark>\u5426<\/mark>\r\n<\/code><\/pre>\n<p>\u60a8\u8fd8\u53ef\u4ee5\u9009\u62e9\u4f7f\u7528\u57df\u540d\u4e0a\u7684\u94fe\u63a5\u8bbf\u95ee\u4e0a\u4f20\u5230\u60a8\u7684Mastodon\u5b9e\u4f8b\u7684\u6587\u4ef6\uff0c\u800c\u4e0d\u662f\u76f4\u63a5\u4f7f\u7528\u4e91\u5b58\u50a8\u7684\u94fe\u63a5\u3002\u5982\u679c\u60a8\u5e0c\u671b\uff0c\u60a8\u53ef\u4ee5\u9009\u62e9\u8fd9\u4e2a\u9009\u9879\uff0c\u4f46\u672c\u6559\u7a0b\u5c06\u9009\u62e9\u4e0d\u4f7f\u7528\u3002\u5982\u679c\u60a8\u6539\u53d8\u4e86\u5bf9\u5b58\u50a8\u7684\u60f3\u6cd5\uff0c\u60a8\u53ef\u4ee5\u7a0d\u540e\u8fd4\u56de\u5e76\u7f16\u8f91\u751f\u6210\u7684\u914d\u7f6e\u6587\u4ef6\u3002\u8bf7\u67e5\u770b\u5b98\u65b9Mastodon\u6587\u6863\uff0c\u4e86\u89e3\u6587\u4ef6\u5b58\u50a8\u7684\u914d\u7f6e\u6587\u4ef6\u53c2\u6570\u3002<\/p>\n<h3>\u914d\u7f6e\u51fa\u7ad9\u7535\u5b50\u90ae\u4ef6<\/h3>\n<p>Mastodon\u9700\u8981\u8bbf\u95eeSMTP\u7535\u5b50\u90ae\u4ef6\u670d\u52a1\u5668\u6765\u53d1\u9001\u7535\u5b50\u90ae\u4ef6\u3002\u5f3a\u70c8\u5efa\u8bae\u4f7f\u7528\u5916\u90e8\u7535\u5b50\u90ae\u4ef6\u670d\u52a1\u63d0\u4f9b\u5546\u800c\u4e0d\u662f\u81ea\u5df1\u8fd0\u884c\u3002Mastodon\u5728\u793a\u4f8b\u4e2d\u4f7f\u7528Mailgun\u3002\u7ef4\u62a4\u4e00\u4e2a\u5b89\u5168\u53ef\u9760\u7684\u7535\u5b50\u90ae\u4ef6\u670d\u52a1\u5668\u662f\u4e00\u9879\u8270\u5de8\u7684\u4efb\u52a1\uff0c\u56e0\u6b64\u5efa\u8bae\u60a8\u4f9d\u9760\u5916\u90e8\u7b2c\u4e09\u65b9\u7535\u5b50\u90ae\u4ef6\u670d\u52a1\u63d0\u4f9b\u5546\u3002\u4f46\u662f\uff0c\u8bf7\u6ce8\u610f\uff0c\u5927\u591a\u6570\u7b2c\u4e09\u65b9\u7535\u5b50\u90ae\u4ef6\u670d\u52a1\u63d0\u4f9b\u5546\u6839\u636e\u6570\u91cf\u6536\u8d39\uff0c\u5e76\u4e14\u53ef\u80fd\u4f1a\u5728\u67d0\u4e2a\u4f7f\u7528\u9608\u503c\u4ee5\u4e0b\u63d0\u4f9b\u514d\u8d39\u670d\u52a1\u5c42\u6b21\u3002\u5728\u8fd9\u79cd\u60c5\u51b5\u4e0b\uff0c\u8bf7\u884c\u4e8b\u8c28\u614e\u3002<\/p>\n<div class=\"post-conf-note\">\n<p class=\"post-conf-desc\">\u6ce8\u610f\uff1a\u5c3d\u7ba1\u53ef\u4ee5\u5728\u4e0d\u7acb\u5373\u8bbe\u7f6eSMTP\u89e3\u51b3\u65b9\u6848\u7684\u60c5\u51b5\u4e0b\u5b8c\u6210\u6b64\u6559\u7a0b\uff0c\u65b9\u6cd5\u662f\u5c06\u6240\u6709\u51ed\u636e\u5b57\u6bb5\u4fdd\u7559\u4e3a\u7a7a\u767d\u6216\u4f7f\u7528\u9ed8\u8ba4\u503c\uff0c\u4f46\u8fd9\u6837\u505a\u5c06\u59a8\u788dMastodon\u7684\u5b8c\u6574\u529f\u80fd\uff0c\u4e0d\u5efa\u8bae\u8fd9\u6837\u505a\u3002\u60a8\u53ef\u4ee5\u9009\u62e9\u4e0e\u7535\u5b50\u90ae\u4ef6\u63d0\u4f9b\u5546\u5efa\u7acb\u5e10\u6237\uff0c\u5e76\u7a0d\u540e\u5c06\u51ed\u636e\u6dfb\u52a0\u5230\u914d\u7f6e\u6587\u4ef6\u4e2d\u3002\u4f46\u662f\uff0c\u8fd9\u610f\u5473\u7740\u5728\u6b64\u4e4b\u524dMastodon\u7684\u90ae\u4ef6\u5c06\u4e0d\u4f1a\u53d1\u9001\uff0c\u5e76\u4e14\u67d0\u4e9b\u529f\u80fd\uff0c\u5982\u5173\u6ce8\u5176\u4ed6\u5e10\u6237\uff0c\u5c06\u4e0d\u53ef\u7528\u3002<\/p>\n<\/div>\n<p>\u5728\u6240\u6709\u7684\u7535\u5b50\u90ae\u4ef6\u63d0\u4f9b\u5546\u4e2d\uff0c\u4f60\u90fd\u9700\u8981\u521b\u5efa\u5e76\u914d\u7f6e\u4e00\u4e2a\u8d26\u6237\u3002\u8fd9\u4e2a\u8fc7\u7a0b\u56e0\u63d0\u4f9b\u5546\u800c\u5f02\u3002\u5f88\u53ef\u80fd\u5728\u6ce8\u518c\u540e\uff0c\u4f60\u9700\u8981\u901a\u8fc7\u9a8c\u8bc1\u4f60\u7684\u57df\u540d\u6765\u542f\u7528\u53d1\u90ae\u4ef6\u529f\u80fd\uff0c\u8fd9\u4e2a\u8fc7\u7a0b\u8981\u5411\u4f60\u7684\u57df\u540d\u6dfb\u52a0DNS\u8bb0\u5f55\u3002\u6b64\u5916\uff0c\u4f60\u8fd8\u9700\u8981\u83b7\u53d6\u6216\u751f\u6210\u4e00\u4e2aAPI\u5bc6\u94a5\u4f5c\u4e3a\u5b89\u5168\u8ba4\u8bc1\u7684\u51ed\u636e\u3002<\/p>\n<p>\u672c\u6559\u7a0b\u4ee5Mailgun\u4e3a\u4f8b\uff0c\u5c3d\u7ba1\u4efb\u4f55\u9009\u62e9\u7684\u7535\u5b50\u90ae\u4ef6\u670d\u52a1\u63d0\u4f9b\u5546\u4e5f\u53ef\u4ee5\u4f7f\u7528\u3002\u8fd9\u4e9b\u9009\u62e9\u4e5f\u53ef\u7528\u4f5c\u5176\u4ed6\u7535\u5b50\u90ae\u4ef6\u670d\u52a1\u63d0\u4f9b\u5546\u7684\u6307\u5357\u3002Mailgun\u5c24\u5176\u4f1a\u81ea\u52a8\u751f\u6210\u6bcf\u4e2a\u6dfb\u52a0\u7684\u57df\u540d\u7684SMTP\u51ed\u8bc1\u3002\u518d\u6b21\u5f3a\u8c03\uff0c\u8fd9\u5c06\u6839\u636e\u60a8\u4f7f\u7528\u7684\u7535\u5b50\u90ae\u4ef6\u670d\u52a1\u7684\u4e0d\u540c\u800c\u6709\u6240\u4e0d\u540c\uff0c\u60a8\u5e94\u8be5\u67e5\u9605\u76f8\u5173\u7684\u6587\u6863\u3002<\/p>\n<pre class=\"post-pre\"><code>SMTP\u670d\u52a1\u5668\uff1a<mark>smtp.mailgun.org<\/mark>\r\nSMTP\u7aef\u53e3\uff1a<mark>587<\/mark>\r\nSMTP\u7528\u6237\u540d\uff1a<mark>your_smtp_username<\/mark>\r\nSMTP\u5bc6\u7801\uff1a<mark>your_smtp_password<\/mark>\r\nSMTP\u8ba4\u8bc1\u65b9\u5f0f\uff1a<mark>plain<\/mark>\r\nSMTP OpenSSL\u9a8c\u8bc1\u6a21\u5f0f\uff1a<mark>peer<\/mark>\r\n\u542f\u7528STARTTLS\uff1a<mark>auto<\/mark>\r\n\u53d1\u9001\u90ae\u4ef6\u7684\u90ae\u7bb1\u5730\u5740\uff1aMastodon &lt;notifications@<mark>your_domain<\/mark>&gt;\r\n<\/code><\/pre>\n<p>\u5c3d\u7ba1\u7eaf\u6587\u672c\u8ba4\u8bc1\u7684\u9ed8\u8ba4\u9009\u9879\u5bf9\u4e8eSMTP\u8ba4\u8bc1\u4f3c\u4e4e\u4e0d\u5408\u9002\uff0c\u4f46\u7535\u5b50\u90ae\u4ef6\u670d\u52a1\u63d0\u4f9b\u5546\u652f\u6301SMTP\u8ba4\u8bc1\u7684\u5e38\u89c1\u9009\u9879\u5305\u62ec\u660e\u6587\u548c\u767b\u5f55\uff0c\u5b83\u4eec\u90fd\u4f7f\u7528\u4e86Base64\u7f16\u7801\u3002\u5355\u72ec\u4f7f\u7528Base64\u7f16\u7801\u4e0d\u8db3\u4ee5\u4f5c\u4e3a\u5b89\u5168\u63aa\u65bd\u3002\u771f\u6b63\u91cd\u8981\u7684\u662f\u901a\u8fc7\u5b89\u5168\u7684TLS\/SSL\u8fde\u63a5\u5411\u60a8\u7684\u7535\u5b50\u90ae\u4ef6\u63d0\u4f9b\u5546\u63d0\u4ea4\u8bf7\u6c42\u3002\u7aef\u53e3587\u4e0a\u7684SMTP\u8fde\u63a5\u662f\u4e0e\u7535\u5b50\u90ae\u4ef6\u63d0\u4f9b\u5546\u7684TLS\u8fde\u63a5\u7684\u9ed8\u8ba4\u9009\u9879\u3002\u5f53\u6b63\u786e\u914d\u7f6eTLS\u65f6\uff0c\u6b64\u9009\u9879\u662f\u5b89\u5168\u7684\u3002\u4f46\u662f\uff0c\u8bf7\u67e5\u9605\u60a8\u7684\u7535\u5b50\u90ae\u4ef6\u670d\u52a1\u63d0\u4f9b\u5546\u7684\u5b98\u65b9\u6587\u6863\uff0c\u4ee5\u83b7\u53d6\u66f4\u8be6\u7ec6\u548c\u5177\u4f53\u7684\u4fe1\u606f\uff0c\u4ee5\u786e\u4fdd\u4e0e\u5176SMTP\u670d\u52a1\u7684\u5b89\u5168\u63a5\u53e3\u3002<\/p>\n<p>\u53d1\u9001\u4e00\u4e2a\u6d4b\u8bd5\u90ae\u4ef6\u4ee5\u786e\u4fdd\u60a8\u7684SMTP\u51ed\u8bc1\u6709\u6548\uff0c\u7136\u540e\u6307\u5b9a\u4e00\u4e2a\u60a8\u53ef\u4ee5\u8bbf\u95ee\u7684\u6536\u4ef6\u4eba\u7535\u5b50\u90ae\u4ef6\uff0c\u6bd4\u5982\u60a8\u7684\u4e2a\u4eba\u7535\u5b50\u90ae\u4ef6\u3002<\/p>\n<pre class=\"post-pre\"><code>\u73b0\u5728\u4f7f\u7528\u6b64\u914d\u7f6e\u53d1\u9001\u6d4b\u8bd5\u90ae\u4ef6\u5417\uff1f <mark>\u662f<\/mark>\r\n<\/code><\/pre>\n<p>\u8fd9\u5c01\u6d4b\u8bd5\u90ae\u4ef6\u53ef\u80fd\u9700\u8981\u4e00\u5206\u949f\u624d\u80fd\u5230\u8fbe\uff0c\u8fd9\u53d6\u51b3\u4e8e\u60a8\u7684\u7535\u5b50\u90ae\u4ef6\u670d\u52a1\u3002\u60a8\u53ef\u4ee5\u7a0d\u540e\u8fd4\u56de\uff0c\u5728\u751f\u6210\u7684Mastodon\u914d\u7f6e\u6587\u4ef6\u4e2d\u66f4\u6539\u60a8\u7684SMTP\u51ed\u636e\u3002<\/p>\n<h3>\u5b8c\u6210\u60a8\u7684\u914d\u7f6e<\/h3>\n<p>\u63a5\u4e0b\u6765\uff0c\u7cfb\u7edf\u4f1a\u63d0\u793a\u60a8\u4fdd\u5b58\u914d\u7f6e\u3002\u7136\u540e\uff0cMastodon\u4f1a\u6839\u636e\u60a8\u7684\u914d\u7f6e\u521b\u5efa\u6570\u636e\u5e93\u3002<\/p>\n<pre class=\"post-pre\"><code>\u6b64\u914d\u7f6e\u5c06\u88ab\u5199\u5165.env.production\u6587\u4ef6\r\n\u4fdd\u5b58\u914d\u7f6e\u5417\uff1f <mark>\u662f<\/mark>\r\n\u65e2\u7136\u914d\u7f6e\u5df2\u4fdd\u5b58\uff0c\u5fc5\u987b\u52a0\u8f7d\u6570\u636e\u5e93\u67b6\u6784\u3002\u5982\u679c\u6570\u636e\u5e93\u5df2\u5b58\u5728\uff0c\u8fd9\u5c06\u64e6\u9664\u5176\u5185\u5bb9\u3002\r\n\u73b0\u5728\u51c6\u5907\u6570\u636e\u5e93\u5417\uff1f <mark>\u662f<\/mark>\r\n\u6b63\u5728\u8fd0\u884c `RAILS_ENV=production rails db:setup` ...\r\n\u5df2\u521b\u5efa\u6570\u636e\u5e93 'mastodon_production'\r\n\u5b8c\u6210\uff01\r\n<\/code><\/pre>\n<p>\u4e4b\u540e\uff0c\u7cfb\u7edf\u4f1a\u63d0\u793a\u4f60\u7f16\u8bd1Mastodon\u7684CSS\u548cJavaScript\u8d44\u6e90\u3002\u8bf7\u6ce8\u610f\u5173\u4e8e\u65f6\u95f4\u548c\u8d44\u6e90\u6d88\u8017\u7684\u8b66\u544a\u3002<\/p>\n<pre class=\"post-pre\"><code>\u6700\u540e\u4e00\u6b65\u662f\u7f16\u8bd1CSS\/JS\u8d44\u6e90\u3002\u8fd9\u53ef\u80fd\u9700\u8981\u4e00\u6bb5\u65f6\u95f4\u5e76\u6d88\u8017\u5927\u91cf\u5185\u5b58\u3002\r\n\u73b0\u5728\u7f16\u8bd1\u8d44\u6e90\u5417\uff1f <mark>\u662f<\/mark>\r\n\u6b63\u5728\u8fd0\u884c `RAILS_ENV=production rails assets:precompile` ...\r\nyarn install v1.22.19\r\n[1\/6] \u9a8c\u8bc1package.json...\r\n[2\/6] \u89e3\u6790\u5305...\r\n[3\/6] \u83b7\u53d6\u5305...\r\n[4\/6] \u94fe\u63a5\u4f9d\u8d56...\r\n. . .\r\n\u5168\u90e8\u5b8c\u6210\uff01\r\n\u60a8\u73b0\u5728\u53ef\u4ee5\u542f\u52a8Mastodon\u670d\u52a1\u5668\u4e86\r\n<\/code><\/pre>\n<p>\u60a8\u7684Mastodon\u670d\u52a1\u5668\u5df2\u51c6\u5907\u5c31\u7eea\uff0c\u4f46\u5c1a\u672a\u8fd0\u884c\u3002\u8fd8\u6709\u53e6\u4e00\u4e2a\u63d0\u793a\u6765\u521b\u5efa\u4e00\u4e2a\u7ba1\u7406\u5458\u8d26\u6237\u4ee5\u767b\u5f55\u60a8\u7684Mastodon\u670d\u52a1\u5668\uff1a<\/p>\n<p>\u60a8\u60f3\u7acb\u5373\u521b\u5efa\u7ba1\u7406\u5458\u7528\u6237\u5417\uff1f<mark>\u662f<\/mark> \u7528\u6237\u540d\uff1a<mark>mastodon<\/mark> \u7535\u5b50\u90ae\u4ef6\uff1a<mark>your_email<\/mark> \u60a8\u53ef\u4ee5\u4f7f\u7528\u4ee5\u4e0b\u5bc6\u7801\u767b\u5f55\uff1a<mark>your_generated_password<\/mark> \u767b\u5f55\u540e\u60a8\u53ef\u4ee5\u66f4\u6539\u5bc6\u7801\u3002<\/p>\n<pre class=\"post-pre\"><code><\/code><\/pre>\n<p>\u8bf7\u6ce8\u610f\uff0c\u76ee\u524d\u60a8\u65e0\u6cd5\u9009\u62e9\u7ba1\u7406\u5458\u8d26\u6237\u7684\u5bc6\u7801\u9009\u9879\u3002\u60a8\u5c06\u4f1a\u83b7\u5f97\u4e00\u4e2a\u72ec\u4e00\u65e0\u4e8c\u3001\u7531\u7cfb\u7edf\u751f\u6210\u7684\u5bc6\u7801\uff0c\u60a8\u5e94\u8be5\u5c06\u5b83\u8bb0\u5f55\u5728\u5176\u4ed6\u5730\u65b9\u3002\u4e00\u65e6\u60a8\u80fd\u591f\u8bbf\u95ee\u7ba1\u7406\u5458\u7528\u6237\u754c\u9762\uff0c\u60a8\u5c31\u6709\u673a\u4f1a\u66f4\u6539\u60a8\u7684\u5bc6\u7801\u3002<\/p>\n<p>\u4f7f\u7528nano\u6216\u60a8\u504f\u597d\u7684\u6587\u5b57\u7f16\u8f91\u5668\u6253\u5f00\u60a8\u751f\u6210\u7684Mastodon\u914d\u7f6e\u6587\u4ef6\uff0c\u4ee5\u9a8c\u8bc1\u5176\u5185\u5bb9\u3002<\/p>\n<pre class=\"post-pre\"><code><\/code><\/pre>\n<ol>\n<li data-prefix=\"$\"><span class=\"token function\">nano<\/span> ~\/live\/.env.production<\/li>\n<\/ol>\n<pre class=\"post-pre\"><code><\/code><\/pre>\n<p>&nbsp;<\/p>\n<pre class=\"post-pre\"><code><\/code><\/pre>\n<p>\u5185\u5bb9\u5c06\u7c7b\u4f3c\u4e8e\u4ee5\u4e0b\u5185\u5bb9:<\/p>\n<div>~\/live\/.env.production<\/p>\n<pre class=\"post-pre\"><code># \u4f7f\u7528 mastodon:setup \u4e8e 2022-11-22 18:22:25 UTC \u751f\u6210\r\n\r\n# \u6b64\u6587\u4ef6\u4e2d\u7684\u67d0\u4e9b\u53d8\u91cf\u5c06\u6839\u636e\u60a8\u662f\u5426\u4f7f\u7528 docker-compose \u800c\u6709\u4e0d\u540c\u7684\u89e3\u91ca\u3002\r\n\r\nLOCAL_DOMAIN=<mark>your_domain<\/mark>\r\nSINGLE_USER_MODE=false\r\nSECRET_KEY_BASE=<mark>your_generated_key_base<\/mark>\r\nOTP_SECRET=<mark>your_generated_secret<\/mark>\r\nVAPID_PRIVATE_KEY=<mark>your_generated_private_key<\/mark>\r\nVAPID_PUBLIC_KEY=<mark>your_generated_public_key<\/mark>\r\nDB_HOST=\/var\/run\/postgresql\r\nDB_PORT=5432\r\nDB_NAME=mastodon_production\r\nDB_USER=mastodon\r\nDB_PASS=\r\nREDIS_HOST=localhost\r\nREDIS_PORT=6379\r\nREDIS_PASSWORD=\r\nS3_ENABLED=true\r\nS3_PROTOCOL=https\r\nS3_BUCKET=<mark>your_spaces_name<\/mark>\r\nS3_REGION=<mark>your_spaces_region<\/mark>\r\nS3_HOSTNAME=<mark>your_spaces_endpoint<\/mark>\r\nS3_ENDPOINT=https:\/\/<mark>your_spaces_endpoint<\/mark>\r\nAWS_ACCESS_KEY_ID=<mark>your_spaces_access_key<\/mark>\r\nAWS_SECRET_ACCESS_KEY=<mark>your_spaces_secret_key<\/mark>\r\nSMTP_SERVER=smtp.mailgun.org\r\nSMTP_PORT=587\r\nSMTP_LOGIN=<mark>your_smtp_username<\/mark>\r\nSMTP_PASSWORD=<mark>your_smtp_password<\/mark>\r\nSMTP_AUTH_METHOD=plain\r\nSMTP_OPENSSL_VERIFY_MODE=peer\r\nSMTP_ENABLE_STARTTLS=auto\r\nSMTP_FROM_ADDRESS='Mastodon &lt;notifications@test.do-community.com&gt;'\r\n<\/code><\/pre>\n<\/div>\n<p>\u5728\u4ea4\u4e92\u5f0f\u8bbe\u7f6e\u8fc7\u7a0b\u5b8c\u6210\u540e\uff0c\u60a8\u53ef\u4ee5\u624b\u52a8\u7f16\u8f91\u6b64\u6587\u4ef6\u3002\u5b8c\u6210\u68c0\u67e5\u540e\uff0c\u8bf7\u4fdd\u5b58\u5e76\u5173\u95ed\u6587\u4ef6\u3002\u5982\u679c\u60a8\u4f7f\u7528\u7684\u662fnano\uff0c\u60a8\u53ef\u4ee5\u4f7f\u7528Ctrl + X\u8fdb\u884c\u4fdd\u5b58\uff0c\u7136\u540e\u5728\u63d0\u793a\u65f6\u6309Y\uff0c\u7136\u540e\u6309Enter\u952e\u3002<\/p>\n<h2>\u7b2c\u56db\u6b65 &#8211; \u4f7f\u7528Certbot\u548cLet&#8217;s Encrypt\u914d\u7f6eNginx\u4ee5\u9002\u5e94Mastodon<\/h2>\n<p>\u60a8\u7684Mastodon\u5e94\u7528\u670d\u52a1\u5668\u76ee\u524d\u53ea\u80fd\u5728\u672c\u5730\u8bbf\u95ee\u3002\u8981\u5141\u8bb8\u901a\u8fc7\u4e92\u8054\u7f51\u8bbf\u95ee\u5b83\uff0c\u60a8\u9700\u8981\u4f7f\u7528\u53cd\u5411\u4ee3\u7406\u8fdb\u884c\u66b4\u9732\u3002\u6211\u4eec\u5efa\u8bae\u4f7f\u7528Nginx\u4f5c\u4e3a\u53cd\u5411\u4ee3\u7406\u6765\u63d0\u4f9b\u60a8\u7684Mastodon\u5e94\u7528\u3002\u5982\u679c\u60f3\u4e86\u89e3\u66f4\u591a\u5173\u4e8e\u53cd\u5411\u4ee3\u7406\u7684\u5185\u5bb9\uff0c\u60a8\u53ef\u4ee5\u67e5\u770b\u6211\u4eec\u7684Nginx\u53cd\u5411\u4ee3\u7406\u914d\u7f6e\u6559\u7a0b\u6216\u8005\u6211\u4eec\u5173\u4e8e\u4ee3\u7406\u7684\u7efc\u5408\u4ecb\u7ecd\u3002<\/p>\n<p>Mastodon\u4ed3\u5e93\u81ea\u5e26\u4e00\u4e2a\u9ed8\u8ba4\u7684Nginx\u914d\u7f6e\u6587\u4ef6\uff0c\u60a8\u53ef\u4ee5\u4f7f\u7528\u5b83\uff0c\u4f46\u662f\u60a8\u9700\u8981\u505a\u4e00\u4e9b\u4fee\u6539\u4ee5\u9002\u5e94\u60a8\u81ea\u5df1\u7684\u57df\u540d\uff0c\u5e76\u4f7f\u7528Certbot\u548cLet&#8217;s Encrypt\u8fdb\u884c\u5b89\u5168\u4fdd\u62a4\u3002\u5c3d\u7ba1Mastodon\u63d0\u4f9b\u7684Nginx\u6587\u4ef6\u5305\u542b\u4e86\u7528\u4e8e\u5b8c\u6574\u90e8\u7f72\u6240\u9700\u7684\u6240\u6709\u5757\u548c\u6307\u4ee4\uff0c\u4f46\u5176\u9ed8\u8ba4\u7684SSL\/TLS\u8bbe\u7f6e\u4f1a\u963b\u788d\u4e0eCertbot\u7684\u987a\u5229\u4ea4\u4e92\u3002\u4e3a\u4e86\u7ed5\u8fc7\u8fd9\u4e2a\u9650\u5236\uff0c\u5728\u4f7f\u7528Certbot\u4e4b\u524d\u548c\u4e4b\u540e\uff0c\u9700\u8981\u5bf9Nginx\u914d\u7f6e\u6587\u4ef6\u8fdb\u884c\u4e24\u6b21\u7f16\u8f91\u3002<\/p>\n<p>\u9996\u5148\uff0c\u8c03\u6574\u9632\u706b\u5899\u8bbe\u7f6e\uff0c\u5141\u8bb8\u5c06HTTP\u548cHTTPS\u6d41\u91cf\u53d1\u9001\u5230\u60a8\u7684Nginx\u670d\u52a1\u5668\u3002<\/p>\n<pre class=\"post-pre\"><code><\/code><\/pre>\n<ol>\n<li data-prefix=\"$\"><span class=\"token function\">sudo<\/span> ufw allow <span class=\"token string\">&#8216;Nginx Full&#8217;<\/span><\/li>\n<\/ol>\n<pre class=\"post-pre\"><code><\/code><\/pre>\n<p>&nbsp;<\/p>\n<pre class=\"post-pre\"><code><\/code><\/pre>\n<p>\u8fd9\u5bf9\u7528\u6237\u8bbf\u95ee\u60a8\u7684Mastodon\u7f51\u7ad9\u662f\u5fc5\u8981\u7684\uff0c\u4f46\u540c\u65f6\u4e5f\u662fCertbot\u8fdb\u884c\u5fc5\u8981\u9a8c\u8bc1\u4ee5\u83b7\u53d6\u8bc1\u4e66\u6240\u9700\u7684\u3002\u63a5\u4e0b\u6765\uff0c\u4eceMastodon\u4ee3\u7801\u5e93\u4e2d\u590d\u5236\u63d0\u4f9b\u7684Nginx\u914d\u7f6e\u3002<\/p>\n<pre class=\"post-pre\"><code><\/code><\/pre>\n<ol>\n<li data-prefix=\"$\"><span class=\"token function\">sudo<\/span> <span class=\"token function\">cp<\/span> \/home\/mastodon\/live\/dist\/nginx.conf \/etc\/nginx\/sites-available\/mastodon<\/li>\n<\/ol>\n<pre class=\"post-pre\"><code><\/code><\/pre>\n<p>&nbsp;<\/p>\n<pre class=\"post-pre\"><code><\/code><\/pre>\n<p>Nginx\u4f7f\u7528\u4e00\u79cd\u5e38\u89c1\u7684\u505a\u6cd5\uff0c\u53eb\u505a\u7b26\u53f7\u94fe\u63a5\uff08symlinks\uff09\uff0c\u6765\u8ddf\u8e2a\u60a8\u7684\u670d\u52a1\u5668\u5757\u4e2d\u54ea\u4e9b\u662f\u542f\u7528\u7684\u3002\u521b\u5efa\u7b26\u53f7\u94fe\u63a5\u5c31\u50cf\u5728\u78c1\u76d8\u4e0a\u521b\u5efa\u4e00\u4e2a\u5feb\u6377\u65b9\u5f0f\uff0c\u8fd9\u6837\u60a8\u4ee5\u540e\u53ef\u4ee5\u4ecesites-enabled\u76ee\u5f55\u4e2d\u5220\u9664\u5feb\u6377\u65b9\u5f0f\uff0c\u540c\u65f6\u4fdd\u7559\u5728sites-available\u4e2d\u7684\u670d\u52a1\u5668\u5757\uff0c\u5982\u679c\u60a8\u60f3\u542f\u7528\u5b83\u7684\u8bdd\u3002\u4f7f\u7528\u60a8\u65b0\u521b\u5efa\u7684\u6587\u4ef6\u521b\u5efa\u4e00\u4e2a\u94fe\u63a5\u3002<\/p>\n<pre class=\"post-pre\"><code><\/code><\/pre>\n<ol>\n<li data-prefix=\"$\"><span class=\"token function\">sudo<\/span> <span class=\"token function\">ln<\/span> <span class=\"token parameter variable\">-s<\/span> \/etc\/nginx\/sites-available\/mastodon \/etc\/nginx\/sites-enabled\/mastodon<\/li>\n<\/ol>\n<pre class=\"post-pre\"><code><\/code><\/pre>\n<p>&nbsp;<\/p>\n<pre class=\"post-pre\"><code><\/code><\/pre>\n<p>\u73b0\u5728\uff0cNginx\u77e5\u9053\u5e94\u8be5\u4f7f\u7528\u914d\u7f6e\u6587\u4ef6\u4e2d\u7684\u8bbe\u7f6e\u6765\u63d0\u4f9b\u60a8\u7684Mastodon\u7f51\u7ad9\u3002\u7136\u800c\uff0c\u60a8\u8fd8\u6ca1\u6709\u5bf9Nginx\u914d\u7f6e\u8fdb\u884c\u5fc5\u8981\u7684\u66f4\u6539\u3002\u7528\u60a8\u559c\u6b22\u7684\u6587\u672c\u7f16\u8f91\u5668\u6253\u5f00\u590d\u5236\u7684\u914d\u7f6e\u6587\u4ef6\u3002<\/p>\n<pre class=\"post-pre\"><code><\/code><\/pre>\n<ol>\n<li data-prefix=\"$\"><span class=\"token function\">sudo<\/span> <span class=\"token function\">nano<\/span> \/etc\/nginx\/sites-enabled\/mastodon<\/li>\n<\/ol>\n<pre class=\"post-pre\"><code><\/code><\/pre>\n<p>&nbsp;<\/p>\n<pre class=\"post-pre\"><code><\/code><\/pre>\n<p>\u60a8\u9700\u8981\u786e\u4fddserver_name\u6307\u4ee4\u6307\u5411\u60a8\u7684\u57df\u540d\u4ee5\u53ca\u60a8\u7684\u57df\u540d\u7684www.\u7248\u672c\u3002\u6709\u4e24\u4e2aserver_name\u5b9e\u4f8b\uff0c\u4e00\u4e2a\u5728\u76d1\u542c\u7aef\u53e380\u7684HTTP\u670d\u52a1\u5668\u5757\u4e2d\uff0c\u53e6\u4e00\u4e2a\u5728\u76d1\u542c\u7aef\u53e3443\u7684HTTPS\u670d\u52a1\u5668\u5757\u4e2d\u3002\u8bf7\u786e\u4fdd\u4e24\u4e2aserver_name\u6307\u4ee4\u90fd\u6307\u5411\u60a8\u7684\u57df\u540d\u3002<\/p>\n<p>\u6b64\u5916\uff0c\u60a8\u9700\u8981\u901a\u8fc7\u5728\u7b2c\u4e8c\u4e2a\u670d\u52a1\u5668\u5757\u7684\u76d1\u542c\u6307\u4ee4\u524d\u6dfb\u52a0\u4e00\u4e2a#\u7b26\u53f7\u6765\u6ce8\u91ca\u6389\u5b83\u3002\u7531\u4e8e\u60a8\u7684SSL\u8bc1\u4e66\u5c1a\u672a\u8bbe\u7f6e\u597d\uff0c\u4e3a\u6b64\u76d1\u542c\u6307\u4ee4\u6dfb\u52a0\u4e00\u4e2assl\u53c2\u6570\u5c06\u5bfc\u81f4Nginx\u5c06\u6b64\u914d\u7f6e\u68c0\u6d4b\u4e3a\u65e0\u6548\u3002\u8fd9\u610f\u5473\u7740Certbot\u4e0d\u4f1a\u4e3a\u60a8\u521b\u5efa\u8bc1\u4e66\u3002\u4e3a\u4e86\u89e3\u51b3\u8fd9\u4e2a\u95ee\u9898\uff0c\u5728\u521b\u5efa\u8bc1\u4e66\u540e\uff0c\u8bf7\u4e34\u65f6\u6ce8\u91ca\u6389\u8fd9\u4e2a\u6307\u4ee4\uff0c\u5e76\u5728\u91cd\u65b0\u542f\u7528\u5b83\u3002<\/p>\n<p>\u6587\u4ef6\u4f4d\u7f6e\uff1a\/etc\/nginx\/sites-enabled\/mastodon<\/p>\n<pre class=\"post-pre\"><code>. . .\r\nserver {\r\n  listen 80;\r\n  listen [::]:80;\r\n  server_name <mark>your_domain<\/mark> www.<mark>your_domain<\/mark>;\r\n  root \/home\/mastodon\/live\/public;\r\n  location \/.well-known\/acme-challenge\/ { allow all; }\r\n  location \/ { return 301 https:\/\/$host$request_uri; }\r\n}\r\n\r\nserver {\r\n  <mark> # listen 443 ssl http2;<\/mark>\r\n  <mark> # listen [::]:443 ssl http2;<\/mark>\r\n  server_name <mark>your_domain<\/mark> www.<mark>your_domain<\/mark>;\r\n. . .\r\n<\/code><\/pre>\n<p>\u5b8c\u6210\u7f16\u8f91\u540e\uff0c\u4fdd\u5b58\u5e76\u5173\u95ed\u6587\u4ef6\u3002\u73b0\u5728\u60a8\u53ef\u4ee5\u51c6\u5907\u4e3a\u5b89\u5168\u7684SSL\/TLS\u8bbf\u95ee\u521b\u5efa\u8bc1\u4e66\u4e86\u3002\u7531\u4e8e\u60a8\u4f7f\u7528\u7684\u662f\u9884\u586b\u5145\u7684Mastodon\u9ed8\u8ba4Nginx\u914d\u7f6e\u6587\u4ef6\uff0c\u56e0\u6b64\u9700\u8981\u4f7f\u7528Certbot\u7684certonly\u547d\u4ee4\u3002\u8fd9\u5141\u8bb8\u60a8\u624b\u52a8\u914d\u7f6e\u914d\u7f6e\u6587\u4ef6\u3002\u5426\u5219\uff0cCertbot\u53ef\u80fd\u4f1a\u5bf9\u4e0eMastodon\u4e0d\u517c\u5bb9\u7684Nginx\u73af\u5883\u505a\u51fa\u5047\u8bbe\u3002<\/p>\n<pre class=\"post-pre\"><code><\/code><\/pre>\n<ol>\n<li data-prefix=\"$\"><span class=\"token function\">sudo<\/span> certbot certonly <span class=\"token parameter variable\">&#8211;nginx<\/span> <span class=\"token parameter variable\">-d<\/span> <mark>your_domain<\/mark> <span class=\"token parameter variable\">-d<\/span> www.<mark>your_domain<\/mark><\/li>\n<\/ol>\n<pre class=\"post-pre\"><code><\/code><\/pre>\n<div class=\"secondary-code-label\" title=\"\u8f93\u51fa\">\u8f93\u51fa<\/p>\n<pre class=\"post-pre\"><code>. . . \u91cd\u8981\u63d0\u793a\uff1a- \u606d\u559c\uff01\u60a8\u7684\u8bc1\u4e66\u548c\u94fe\u5df2\u4fdd\u5b58\u5728\uff1a\/etc\/letsencrypt\/live\/<mark>your_domain<\/mark>\/fullchain.pem \u60a8\u7684\u5bc6\u94a5\u6587\u4ef6\u5df2\u4fdd\u5b58\u5728\uff1a\/etc\/letsencrypt\/live\/<mark>your_domain<\/mark>\/privkey.pem . . .\r\n<\/code><\/pre>\n<\/div>\n<p>\u8bf7\u6ce8\u610f\u60a8\u751f\u6210\u7684\u8bc1\u4e66\u548c\u5bc6\u94a5\u6587\u4ef6\u7684\u8def\u5f84\u3002\u60a8\u9700\u8981\u5c06\u8fd9\u4e9b\u4fe1\u606f\u6dfb\u52a0\u5230\u914d\u7f6e\u6587\u4ef6\u4e2d\u3002\u518d\u6b21\u4f7f\u7528\u60a8\u504f\u597d\u7684\u6587\u672c\u7f16\u8f91\u5668\u6253\u5f00\u914d\u7f6e\u6587\u4ef6\u3002<\/p>\n<pre class=\"post-pre\"><code><\/code><\/pre>\n<ol>\n<li data-prefix=\"$\"><span class=\"token function\">sudo<\/span> <span class=\"token function\">nano<\/span> \/etc\/nginx\/sites-enabled\/mastodon<\/li>\n<\/ol>\n<pre class=\"post-pre\"><code><\/code><\/pre>\n<p>\u8bf7\u56de\u60f3\u4e4b\u524d\u9488\u5bf9\u7aef\u53e3443\u6ce8\u91ca\u6389\u7684\u76d1\u542c\u6307\u4ee4\u3002\u73b0\u5728\u60a8\u53ef\u4ee5\u5b89\u5168\u5730\u53d6\u6d88\u8fd9\u4e9b\u6ce8\u91ca\u3002\u4e4b\u524d\uff0c\u7531\u4e8e\u7f3a\u5c11\u8bc1\u4e66\uff0c\u8fd9\u4e9b\u884c\u4f1a\u5bfc\u81f4\u9519\u8bef\u3002\u901a\u8fc7Certbot\u65b0\u521b\u5efa\u7684\u8bc1\u4e66\uff0c\u8fd9\u4e9b\u884c\u73b0\u5728\u6709\u6548\u3002<\/p>\n<p>\u6b64\u5916\uff0c\u5728\u540c\u4e00\u533a\u5757\u4e2d\u53d6\u6d88\u6ce8\u91ca ssl_certificate \u548c ssl_certificate_key \u6307\u4ee4\u3002\u786e\u4fdd\u5b83\u4eec\u4e0e\u4e4b\u524d\u7531Certbot\u751f\u6210\u7684\u8bc1\u4e66\u6587\u4ef6\u8def\u5f84\u5339\u914d\u3002<\/p>\n<div>\/etc\/nginx\/sites-enabled\/mastodon \u7684\u8def\u5f84<\/p>\n<pre class=\"post-pre\"><code>. . .\r\nserver {\r\n  <mark> <\/mark>listen 443 ssl http2;\r\n  <mark> <\/mark>listen [::]:443 ssl http2;\r\n  server_name your_domain www.your_domain;\r\n. . . \r\n  # \u83b7\u53d6\u8bc1\u4e66\u540e\u53d6\u6d88\u8fd9\u4e9b\u884c\u7684\u6ce8\u91ca\uff1a\r\n  <mark> <\/mark>ssl_certificate \t\/etc\/letsencrypt\/live\/<mark>your_domain<\/mark>\/fullchain.pem;\r\n  <mark> <\/mark>ssl_certificate_key \/etc\/letsencrypt\/live\/<mark>your_domain<\/mark>\/privkey.pem;\r\n. . .\r\n<\/code><\/pre>\n<\/div>\n<p>\u4fdd\u5b58\u6587\u4ef6\u5e76\u9000\u51fa\u6587\u672c\u7f16\u8f91\u5668\u3002\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\u9a8c\u8bc1Nginx\u914d\u7f6e\u6587\u4ef6\u662f\u5426\u6709\u6548\uff1a<\/p>\n<pre class=\"post-pre\"><code><\/code><\/pre>\n<ol>\n<li data-prefix=\"$\"><span class=\"token function\">sudo<\/span> nginx <span class=\"token parameter variable\">-t<\/span><\/li>\n<\/ol>\n<pre class=\"post-pre\"><code><\/code><\/pre>\n<p>\u6700\u540e\uff0c\u91cd\u65b0\u52a0\u8f7dNginx\u4ee5\u5e94\u7528\u66f4\u6539\u3002<\/p>\n<pre class=\"post-pre\"><code><\/code><\/pre>\n<ol>\n<li data-prefix=\"$\"><span class=\"token function\">sudo<\/span> systemctl reload nginx<\/li>\n<\/ol>\n<pre class=\"post-pre\"><code><\/code><\/pre>\n<p>\u60a8\u7684Mastodon\u670d\u52a1\u5668\u76ee\u524d\u7531Nginx\u63d0\u4f9b\u670d\u52a1\uff0c\u4f46\u5728\u8bbf\u95ee\u7f51\u7ad9\u4e4b\u524d\uff0c\u60a8\u4ecd\u9700\u8981\u8bbe\u7f6e\u4e00\u4e9b\u670d\u52a1\u3002<\/p>\n<h2>\u7b2c\u4e94\u6b65 \u2014 \u8bbe\u7f6eMastodon\u670d\u52a1<\/h2>\n<h2>\u7b2c\u4e03\u90e8\u5206\uff1a\u914d\u7f6e\u548c\u542f\u52a8Mastodon\u670d\u52a1<\/h2>\n<p>Mastodon\u7531\u4e09\u4e2a\u7cfb\u7edf\u670d\u52a1\u7ec4\u6210\uff0c\u4ee5\u7ef4\u6301\u529f\u80fd\u6027\u548c\u6b63\u5e38\u8fd0\u884c\uff1amastodon-web\u3001mastodon-sidekiq\u548cmastodon-streaming\u3002\u8fd9\u4f7f\u5f97Mastodon\u80fd\u591f\u81ea\u52a8\u91cd\u65b0\u542f\u52a8\u5e76\u4fdd\u6301Web\u5e94\u7528\u7a0b\u5e8f\u548c\u5f02\u6b65\u4efb\u52a1\u8c03\u5ea6\u7684\u8fd0\u884c\u3002Mastodon\u9884\u88c5\u4e86\u8fd9\u4e9b\u670d\u52a1\uff0c\u60a8\u53ea\u9700\u5c06\u5b83\u4eec\u653e\u7f6e\u5728\u6b63\u786e\u7684\u4f4d\u7f6e\u5e76\u542f\u7528\u5373\u53ef\u3002<\/p>\n<p>\u9996\u5148\uff0c\u4eceMastodon\u6e90\u4ee3\u7801\u4e2d\u590d\u5236\u670d\u52a1\u6587\u4ef6\u3002<\/p>\n<pre class=\"post-pre\"><code>sudo cp \/home\/mastodon\/live\/dist\/mastodon-*.service \/etc\/systemd\/system\/<\/code><\/pre>\n<p>\u8fd9\u4e9b\u6587\u4ef6\u5047\u8bbe\u60a8\u6309\u7167\u9ed8\u8ba4\u8bbe\u7f6e\u5b89\u88c5\u4e86\u6240\u6709\u5185\u5bb9\uff0c\u4f8b\u5982\u5c06mastodon\u4f5c\u4e3a\u60a8\u7684\u7528\u6237\u540d\u3002\u5982\u679c\u60a8\u4f7f\u7528\u4e86\u4e0e\u9ed8\u8ba4\u8bbe\u7f6e\u6216\u672c\u6559\u7a0b\u5efa\u8bae\u4e0d\u540c\u7684\u914d\u7f6e\uff0c\u60a8\u53ef\u4ee5\u5728\u60a8\u504f\u597d\u7684\u6587\u672c\u7f16\u8f91\u5668\u4e2d\u6253\u5f00\u8fd9\u4e9b\u6587\u4ef6\uff0c\u68c0\u67e5\u662f\u5426\u9700\u8981\u66f4\u6539\u4efb\u4f55\u7528\u6237\u540d\u6216\u8def\u5f84\u3002<\/p>\n<pre class=\"post-pre\"><code>sudo nano \/etc\/systemd\/system\/mastodon-*.service<\/code><\/pre>\n<p>\u5982\u679c\u60a8\u6309\u7167\u672c\u6559\u7a0b\u7684\u6b65\u9aa4\u64cd\u4f5c\uff0c\u5219\u4e0d\u9700\u8981\u66f4\u6539\u4efb\u4f55\u5185\u5bb9\u3002\u68c0\u67e5\u5b8c\u6587\u4ef6\u540e\uff0c\u5173\u95ed\u5b83\u4eec\u5e76\u7ee7\u7eed\u6fc0\u6d3b\u8fd9\u4e9b\u670d\u52a1\u3002\u9996\u5148\uff0c\u60a8\u9700\u8981\u8c03\u7528daemon-reload\u4ee5\u4f7f\u7cfb\u7edf\u8bc6\u522b\u8fd9\u4e9b\u670d\u52a1\u3002<\/p>\n<pre class=\"post-pre\"><code>sudo systemctl daemon-reload<\/code><\/pre>\n<p>\u7136\u540e\u60a8\u53ef\u4ee5\u542f\u7528\u65b0\u8bc6\u522b\u7684\u670d\u52a1\u3002<\/p>\n<pre class=\"post-pre\"><code>sudo systemctl enable --now mastodon-web mastodon-sidekiq mastodon-streaming<\/code><\/pre>\n<pre class=\"post-pre\">Created symlink \/etc\/systemd\/system\/multi-user.target.wants\/mastodon-web.service \u2192 \/etc\/systemd\/system\/mastodon-web.service.\r\nCreated symlink \/etc\/systemd\/system\/multi-user.target.wants\/mastodon-sidekiq.service \u2192 \/etc\/systemd\/system\/mastodon-sidekiq.service.\r\nCreated symlink \/etc\/systemd\/system\/multi-user.target.wants\/mastodon-streaming.service \u2192 \/etc\/systemd\/system\/mastodon-streaming.service.<\/pre>\n<p>\u60a8\u7684Mastodon\u5b89\u88c5\u5df2\u7ecf\u5b8c\u6210\u3002\u60a8\u53ef\u4ee5\u901a\u8fc7\u8bbf\u95eehttps:\/\/your_domain\u5728\u6d4f\u89c8\u5668\u4e2d\u6253\u5f00Mastodon\u3002\u8bf7\u6ce8\u610f\uff0c\u5f53\u60a8\u9996\u6b21\u5728\u6d4f\u89c8\u5668\u4e2d\u5c1d\u8bd5\u6253\u5f00Mastodon\u65f6\uff0c\u4f1a\u89e6\u53d1\u4e00\u4e9b\u540e\u7aef\u521d\u59cb\u5316\u8fc7\u7a0b\uff0c\u8fd9\u4e9b\u8fc7\u7a0b\u53ef\u80fd\u5728\u9875\u9762\u52a0\u8f7d\u5b8c\u6210\u4e4b\u524d\u5c1a\u672a\u5b8c\u5168\u7ed3\u675f\uff0c\u53ef\u80fd\u4f1a\u5bfc\u81f4\u51fa\u73b0\u8bf8\u5982&#8221;We&#8217;re sorry, but something went wrong on our end&#8221;\u7b49\u9519\u8bef\u3002\u5728\u8fd9\u79cd\u60c5\u51b5\u4e0b\uff0c\u8bf7\u7b49\u5f85\u51e0\u79d2\u949f\uff0c\u7136\u540e\u6309\u4f4fShift\u952e\u5237\u65b0\u6d4f\u89c8\u5668\u8fdb\u884c\u5f3a\u5236\u5237\u65b0\uff0c\u8fd9\u5c06\u89e3\u51b3\u8be5\u95ee\u9898\u3002\u8fd9\u4e2a\u95ee\u9898\u4ec5\u4f1a\u5728\u7b2c\u4e00\u6b21\u52a0\u8f7dMastodon\u65f6\u51fa\u73b0\u3002<\/p>\n<div><img decoding=\"async\" class=\"post-images\" title=\"Mastodon\u4e3b\u9875\" src=\"https:\/\/cdn.silicloud.com\/blog-img\/blog\/img\/6564554da4b2f92e6c720c8a\/146-0.png\" alt=\"Mastodon Homepage\" \/><\/div>\n<p>\u60a8\u53ef\u4ee5\u4f7f\u7528\u4e4b\u524d\u521b\u5efa\u7684\u7ba1\u7406\u5458\u7528\u6237\u540d\u548c\u751f\u6210\u7684\u5bc6\u7801\u6765\u767b\u5f55\u5e76\u5f00\u59cb\u4f7f\u7528\u3002<\/p>\n<h2>\u7ed3\u8bba<\/h2>\n<p>\u5728\u672c\u6559\u7a0b\u4e2d\uff0c\u60a8\u5df2\u7ecf\u6210\u529f\u8bbe\u7f6e\u4e86\u81ea\u5df1\u7684Mastodon\u670d\u52a1\u5668\u3002\u8fd9\u5305\u62ec\u8bbe\u7f6e\u6570\u636e\u5e93\u548c\u5e26\u6709\u53cd\u5411\u4ee3\u7406\u7684Web\u670d\u52a1\u5668\uff0c\u4ee5\u53ca\u4e0eMastodon\u76f8\u5173\u7684\u6240\u6709\u8981\u6c42\u548c\u4f9d\u8d56\u9879\u3002\u5728Mastodon\u4e2d\uff0c\u60a8\u8bbe\u7f6e\u4e86\u7535\u5b50\u90ae\u4ef6\u3001\u5b58\u50a8\u548c\u8d44\u4ea7\uff0c\u7136\u540e\u521b\u5efa\u4e86\u7b2c\u4e00\u4e2a\u7ba1\u7406\u5458\u8d26\u6237\u3002\u6700\u540e\uff0c\u60a8\u4f7f\u7528Certbot\u548cLet&#8217;s Encrypt\u4e3a\u60a8\u7684\u8bbe\u7f6e\u6dfb\u52a0\u4e86SSL\/TLS\u5b89\u5168\u4fdd\u62a4\u3002<\/p>\n<p>\u5efa\u8bae\u60a8\u7acb\u5373\u66f4\u6539\u65b0\u8bbe\u7f6e\u597d\u7684Mastodon\u670d\u52a1\u5668\u7684\u5bc6\u7801\u548c\u7ba1\u7406\u8bbe\u7f6e\u3002\u8981\u4e86\u89e3\u5982\u4f55\u4f7f\u7528\u60a8\u7684\u65b0Mastodon\u5b9e\u4f8b\u5e76\u63a2\u7d22\u5176\u529f\u80fd\uff0c\u60a8\u53ef\u4ee5\u67e5\u770b\u6211\u4eec\u7684\u300a\u5982\u4f55\u4f7f\u7528Silicon Cloud Marketplace 1-Click\u8fdb\u884cMastodon\u5b89\u88c5\u300b\u6559\u7a0b\u4e2d\u7684\u6b65\u9aa44\u81f36\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u7b80\u4ecb Mastodon\uff08\u957f\u6bdb\u8c61\uff09\u662f\u4e00\u6b3e\u57fa\u4e8e\u53bb\u4e2d\u5fc3\u5316\u6a21\u5f0f\u7684\u5fae\u535a\u793e\u4ea4\u5e94\u7528\uff0c\u4e5f\u88ab\u79f0\u4e3a\u8054\u90a6\u7f51\u7edc\u3002Mastodon\u662f\u5f00\u6e90 [&hellip;]<\/p>\n","protected":false},"author":4,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[483,199,176,331,2319],"class_list":["post-901","post","type-post","status-publish","format-standard","hentry","category-uncategorized","tag-linux","tag-mastodon","tag-ubuntu-20-04","tag-331","tag-2319"],"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>2023\u5b8c\u6574\u6559\u7a0b\uff1a\u5728Ubuntu 20.04\u4e0a\u8f7b\u677e\u5b89\u88c5Mastodon\u793e\u4ea4\u7f51\u7edc\u5e73\u53f0 - Blog - Silicon Cloud<\/title>\n<meta name=\"description\" content=\"\u8be6\u7ec6\u6559\u7a0b\u6559\u60a8\u5982\u4f55\u5728Ubuntu 20.04\u670d\u52a1\u5668\u4e0a\u5b89\u88c5\u548c\u914d\u7f6eMastodon\u5f00\u6e90\u793e\u4ea4\u7f51\u7edc\u5e73\u53f0\u3002\u672c\u6307\u5357\u5305\u542b\u6240\u6709\u5fc5\u8981\u6b65\u9aa4\uff0c\u4ece\u73af\u5883\u51c6\u5907\u5230\u6700\u7ec8\u90e8\u7f72\uff0c\u9002\u5408Linux\u521d\u5b66\u8005\u548c\u7cfb\u7edf\u7ba1\u7406\u5458\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-20-04\u4e0a\u5b89\u88c5mastodon\/\" \/>\n<meta property=\"og:locale\" content=\"zh_CN\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"2023\u5b8c\u6574\u6559\u7a0b\uff1a\u5728Ubuntu 20.04\u4e0a\u8f7b\u677e\u5b89\u88c5Mastodon\u793e\u4ea4\u7f51\u7edc\u5e73\u53f0\" \/>\n<meta property=\"og:description\" content=\"\u8be6\u7ec6\u6559\u7a0b\u6559\u60a8\u5982\u4f55\u5728Ubuntu 20.04\u670d\u52a1\u5668\u4e0a\u5b89\u88c5\u548c\u914d\u7f6eMastodon\u5f00\u6e90\u793e\u4ea4\u7f51\u7edc\u5e73\u53f0\u3002\u672c\u6307\u5357\u5305\u542b\u6240\u6709\u5fc5\u8981\u6b65\u9aa4\uff0c\u4ece\u73af\u5883\u51c6\u5907\u5230\u6700\u7ec8\u90e8\u7f72\uff0c\u9002\u5408Linux\u521d\u5b66\u8005\u548c\u7cfb\u7edf\u7ba1\u7406\u5458\u3002\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.silicloud.com\/zh\/blog\/\u5982\u4f55\u5728ubuntu-20-04\u4e0a\u5b89\u88c5mastodon\/\" \/>\n<meta property=\"og:site_name\" content=\"Blog - Silicon Cloud\" \/>\n<meta property=\"article:published_time\" content=\"2024-02-04T11:36:13+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2025-08-03T08:41:47+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/cdn.silicloud.com\/blog-img\/blog\/img\/6564554da4b2f92e6c720c8a\/146-0.png\" \/>\n<meta name=\"author\" content=\"\u79d1, \u96c5\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"\u4f5c\u8005\" \/>\n\t<meta name=\"twitter:data1\" content=\"\u79d1, \u96c5\" \/>\n\t<meta name=\"twitter:label2\" content=\"\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4\" \/>\n\t<meta name=\"twitter:data2\" content=\"5 \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-20-04%e4%b8%8a%e5%ae%89%e8%a3%85mastodon\/\",\"url\":\"https:\/\/www.silicloud.com\/zh\/blog\/%e5%a6%82%e4%bd%95%e5%9c%a8ubuntu-20-04%e4%b8%8a%e5%ae%89%e8%a3%85mastodon\/\",\"name\":\"2023\u5b8c\u6574\u6559\u7a0b\uff1a\u5728Ubuntu 20.04\u4e0a\u8f7b\u677e\u5b89\u88c5Mastodon\u793e\u4ea4\u7f51\u7edc\u5e73\u53f0 - Blog - Silicon Cloud\",\"isPartOf\":{\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/#website\"},\"datePublished\":\"2024-02-04T11:36:13+00:00\",\"dateModified\":\"2025-08-03T08:41:47+00:00\",\"author\":{\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/#\/schema\/person\/41e222757cdd2a3365361328bd79970a\"},\"description\":\"\u8be6\u7ec6\u6559\u7a0b\u6559\u60a8\u5982\u4f55\u5728Ubuntu 20.04\u670d\u52a1\u5668\u4e0a\u5b89\u88c5\u548c\u914d\u7f6eMastodon\u5f00\u6e90\u793e\u4ea4\u7f51\u7edc\u5e73\u53f0\u3002\u672c\u6307\u5357\u5305\u542b\u6240\u6709\u5fc5\u8981\u6b65\u9aa4\uff0c\u4ece\u73af\u5883\u51c6\u5907\u5230\u6700\u7ec8\u90e8\u7f72\uff0c\u9002\u5408Linux\u521d\u5b66\u8005\u548c\u7cfb\u7edf\u7ba1\u7406\u5458\u3002\",\"breadcrumb\":{\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/%e5%a6%82%e4%bd%95%e5%9c%a8ubuntu-20-04%e4%b8%8a%e5%ae%89%e8%a3%85mastodon\/#breadcrumb\"},\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.silicloud.com\/zh\/blog\/%e5%a6%82%e4%bd%95%e5%9c%a8ubuntu-20-04%e4%b8%8a%e5%ae%89%e8%a3%85mastodon\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/%e5%a6%82%e4%bd%95%e5%9c%a8ubuntu-20-04%e4%b8%8a%e5%ae%89%e8%a3%85mastodon\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\u9996\u9875\",\"item\":\"https:\/\/www.silicloud.com\/zh\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"2023\u5b8c\u6574\u6559\u7a0b\uff1a\u5728Ubuntu 20.04\u4e0a\u8f7b\u677e\u5b89\u88c5Mastodon\u793e\u4ea4\u7f51\u7edc\u5e73\u53f0\"}]},{\"@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\/41e222757cdd2a3365361328bd79970a\",\"name\":\"\u79d1, \u96c5\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"zh-Hans\",\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/1b2d3e00a7df03689797ebd4af8c5827ba5af936849a71050ec331f4cf902c5d?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/1b2d3e00a7df03689797ebd4af8c5827ba5af936849a71050ec331f4cf902c5d?s=96&d=mm&r=g\",\"caption\":\"\u79d1, \u96c5\"},\"url\":\"https:\/\/www.silicloud.com\/zh\/blog\/author\/keya\/\"},{\"@type\":\"ImageObject\",\"inLanguage\":\"zh-Hans\",\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/%e5%a6%82%e4%bd%95%e5%9c%a8ubuntu-20-04%e4%b8%8a%e5%ae%89%e8%a3%85mastodon\/#local-main-organization-logo\",\"url\":\"\",\"contentUrl\":\"\",\"caption\":\"Blog - Silicon Cloud\"}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"2023\u5b8c\u6574\u6559\u7a0b\uff1a\u5728Ubuntu 20.04\u4e0a\u8f7b\u677e\u5b89\u88c5Mastodon\u793e\u4ea4\u7f51\u7edc\u5e73\u53f0 - Blog - Silicon Cloud","description":"\u8be6\u7ec6\u6559\u7a0b\u6559\u60a8\u5982\u4f55\u5728Ubuntu 20.04\u670d\u52a1\u5668\u4e0a\u5b89\u88c5\u548c\u914d\u7f6eMastodon\u5f00\u6e90\u793e\u4ea4\u7f51\u7edc\u5e73\u53f0\u3002\u672c\u6307\u5357\u5305\u542b\u6240\u6709\u5fc5\u8981\u6b65\u9aa4\uff0c\u4ece\u73af\u5883\u51c6\u5907\u5230\u6700\u7ec8\u90e8\u7f72\uff0c\u9002\u5408Linux\u521d\u5b66\u8005\u548c\u7cfb\u7edf\u7ba1\u7406\u5458\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-20-04\u4e0a\u5b89\u88c5mastodon\/","og_locale":"zh_CN","og_type":"article","og_title":"2023\u5b8c\u6574\u6559\u7a0b\uff1a\u5728Ubuntu 20.04\u4e0a\u8f7b\u677e\u5b89\u88c5Mastodon\u793e\u4ea4\u7f51\u7edc\u5e73\u53f0","og_description":"\u8be6\u7ec6\u6559\u7a0b\u6559\u60a8\u5982\u4f55\u5728Ubuntu 20.04\u670d\u52a1\u5668\u4e0a\u5b89\u88c5\u548c\u914d\u7f6eMastodon\u5f00\u6e90\u793e\u4ea4\u7f51\u7edc\u5e73\u53f0\u3002\u672c\u6307\u5357\u5305\u542b\u6240\u6709\u5fc5\u8981\u6b65\u9aa4\uff0c\u4ece\u73af\u5883\u51c6\u5907\u5230\u6700\u7ec8\u90e8\u7f72\uff0c\u9002\u5408Linux\u521d\u5b66\u8005\u548c\u7cfb\u7edf\u7ba1\u7406\u5458\u3002","og_url":"https:\/\/www.silicloud.com\/zh\/blog\/\u5982\u4f55\u5728ubuntu-20-04\u4e0a\u5b89\u88c5mastodon\/","og_site_name":"Blog - Silicon Cloud","article_published_time":"2024-02-04T11:36:13+00:00","article_modified_time":"2025-08-03T08:41:47+00:00","og_image":[{"url":"https:\/\/cdn.silicloud.com\/blog-img\/blog\/img\/6564554da4b2f92e6c720c8a\/146-0.png"}],"author":"\u79d1, \u96c5","twitter_card":"summary_large_image","twitter_misc":{"\u4f5c\u8005":"\u79d1, \u96c5","\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4":"5 \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-20-04%e4%b8%8a%e5%ae%89%e8%a3%85mastodon\/","url":"https:\/\/www.silicloud.com\/zh\/blog\/%e5%a6%82%e4%bd%95%e5%9c%a8ubuntu-20-04%e4%b8%8a%e5%ae%89%e8%a3%85mastodon\/","name":"2023\u5b8c\u6574\u6559\u7a0b\uff1a\u5728Ubuntu 20.04\u4e0a\u8f7b\u677e\u5b89\u88c5Mastodon\u793e\u4ea4\u7f51\u7edc\u5e73\u53f0 - Blog - Silicon Cloud","isPartOf":{"@id":"https:\/\/www.silicloud.com\/zh\/blog\/#website"},"datePublished":"2024-02-04T11:36:13+00:00","dateModified":"2025-08-03T08:41:47+00:00","author":{"@id":"https:\/\/www.silicloud.com\/zh\/blog\/#\/schema\/person\/41e222757cdd2a3365361328bd79970a"},"description":"\u8be6\u7ec6\u6559\u7a0b\u6559\u60a8\u5982\u4f55\u5728Ubuntu 20.04\u670d\u52a1\u5668\u4e0a\u5b89\u88c5\u548c\u914d\u7f6eMastodon\u5f00\u6e90\u793e\u4ea4\u7f51\u7edc\u5e73\u53f0\u3002\u672c\u6307\u5357\u5305\u542b\u6240\u6709\u5fc5\u8981\u6b65\u9aa4\uff0c\u4ece\u73af\u5883\u51c6\u5907\u5230\u6700\u7ec8\u90e8\u7f72\uff0c\u9002\u5408Linux\u521d\u5b66\u8005\u548c\u7cfb\u7edf\u7ba1\u7406\u5458\u3002","breadcrumb":{"@id":"https:\/\/www.silicloud.com\/zh\/blog\/%e5%a6%82%e4%bd%95%e5%9c%a8ubuntu-20-04%e4%b8%8a%e5%ae%89%e8%a3%85mastodon\/#breadcrumb"},"inLanguage":"zh-Hans","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.silicloud.com\/zh\/blog\/%e5%a6%82%e4%bd%95%e5%9c%a8ubuntu-20-04%e4%b8%8a%e5%ae%89%e8%a3%85mastodon\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.silicloud.com\/zh\/blog\/%e5%a6%82%e4%bd%95%e5%9c%a8ubuntu-20-04%e4%b8%8a%e5%ae%89%e8%a3%85mastodon\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\u9996\u9875","item":"https:\/\/www.silicloud.com\/zh\/blog\/"},{"@type":"ListItem","position":2,"name":"2023\u5b8c\u6574\u6559\u7a0b\uff1a\u5728Ubuntu 20.04\u4e0a\u8f7b\u677e\u5b89\u88c5Mastodon\u793e\u4ea4\u7f51\u7edc\u5e73\u53f0"}]},{"@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\/41e222757cdd2a3365361328bd79970a","name":"\u79d1, \u96c5","image":{"@type":"ImageObject","inLanguage":"zh-Hans","@id":"https:\/\/www.silicloud.com\/zh\/blog\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/1b2d3e00a7df03689797ebd4af8c5827ba5af936849a71050ec331f4cf902c5d?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/1b2d3e00a7df03689797ebd4af8c5827ba5af936849a71050ec331f4cf902c5d?s=96&d=mm&r=g","caption":"\u79d1, \u96c5"},"url":"https:\/\/www.silicloud.com\/zh\/blog\/author\/keya\/"},{"@type":"ImageObject","inLanguage":"zh-Hans","@id":"https:\/\/www.silicloud.com\/zh\/blog\/%e5%a6%82%e4%bd%95%e5%9c%a8ubuntu-20-04%e4%b8%8a%e5%ae%89%e8%a3%85mastodon\/#local-main-organization-logo","url":"","contentUrl":"","caption":"Blog - Silicon Cloud"}]}},"_links":{"self":[{"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/posts\/901","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\/4"}],"replies":[{"embeddable":true,"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/comments?post=901"}],"version-history":[{"count":4,"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/posts\/901\/revisions"}],"predecessor-version":[{"id":110889,"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/posts\/901\/revisions\/110889"}],"wp:attachment":[{"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/media?parent=901"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/categories?post=901"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/tags?post=901"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}