<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/">
    <channel>
        <title>Mongo</title>
        <link>https://paragraph.com/@mongo</link>
        <description>undefined</description>
        <lastBuildDate>Fri, 10 Jul 2026 00:20:18 GMT</lastBuildDate>
        <docs>https://validator.w3.org/feed/docs/rss2.html</docs>
        <generator>https://github.com/jpmonette/feed</generator>
        <language>en</language>
        <image>
            <title>Mongo</title>
            <url>https://storage.googleapis.com/papyrus_images/826448f5e97b060e16a10311253ad21e65a48eb4123f1fe70bcf13e87131906c.png</url>
            <link>https://paragraph.com/@mongo</link>
        </image>
        <copyright>All rights reserved</copyright>
        <item>
            <title><![CDATA[gitlab部署文档 ]]></title>
            <link>https://paragraph.com/@mongo/gitlab</link>
            <guid>i2cLxhu0HW6JtXJsaa0P</guid>
            <pubDate>Mon, 22 Nov 2021 16:14:05 GMT</pubDate>
            <description><![CDATA[gitlab部署文档配置环境: Ubuntu 20.04 安装包版本：gitlab-ce_13.8.4 arm64 文件系统： linux ext4目录确认配置在线安装离线安装修改配置运行安全配置-与letsencrypt配合续签配置使用客户端连接常用操作用户管理确认配置内存小于4G将无法完成安装FAT文件系统不允许创建符号连接，会导致安装失败在线安装到gitlab官网下载安装合适的版本，本文使用的是Ubuntu 20.04，从官网得知这个版本的代号是“focal”访问 https://packages.gitlab.com/gitlab/gitlab-ce选择 ubuntu/focal选择需要安装的版本，例如 gitlab-ce_13.8.4-ce.0_arm64.deb跳转的页面上有安装教程，首先下载安装脚本 curl -s https://packages.gitlab.com/install/repositories/gitlab/gitlab-ce/script.deb.sh | sudo bash然后执行安装 sudo apt-get install gitlab-c...]]></description>
            <content:encoded><![CDATA[<h1 id="h-gitlab" class="text-4xl font-header !mt-8 !mb-4 first:!mt-0 first:!mb-0">gitlab部署文档</h1><p>配置环境: Ubuntu 20.04</p><p>安装包版本：gitlab-ce_13.8.4 arm64</p><p>文件系统： linux ext4</p><h1 id="h-" class="text-4xl font-header !mt-8 !mb-4 first:!mt-0 first:!mb-0">目录</h1><ul><li><p>确认配置</p></li><li><p>在线安装</p></li><li><p>离线安装</p></li><li><p>修改配置</p></li><li><p>运行</p></li><li><p>安全配置-与letsencrypt配合</p></li><li><p>续签配置</p></li><li><p>使用客户端连接</p></li><li><p>常用操作</p></li><li><p>用户管理</p></li></ul><h1 id="h-" class="text-4xl font-header !mt-8 !mb-4 first:!mt-0 first:!mb-0">确认配置</h1><p>内存小于4G将无法完成安装FAT文件系统不允许创建符号连接，会导致安装失败</p><h1 id="h-" class="text-4xl font-header !mt-8 !mb-4 first:!mt-0 first:!mb-0">在线安装</h1><ol><li><p>到gitlab官网下载安装合适的版本，本文使用的是Ubuntu 20.04，从官网得知这个版本的代号是“focal”</p></li><li><p>访问 <code>https://packages.gitlab.com/gitlab/gitlab-ce</code></p></li><li><p>选择 <code>ubuntu/focal</code></p></li><li><p>选择需要安装的版本，例如 <code>gitlab-ce_13.8.4-ce.0_arm64.deb</code></p></li><li><p>跳转的页面上有安装教程，首先下载安装脚本 <code>curl -s https://packages.gitlab.com/install/repositories/gitlab/gitlab-ce/script.deb.sh | sudo bash</code></p></li><li><p>然后执行安装 <code>sudo apt-get install gitlab-ce=13.8.4-ce.0</code></p></li><li><p>安装完成</p></li></ol><h1 id="h-" class="text-4xl font-header !mt-8 !mb-4 first:!mt-0 first:!mb-0">离线安装</h1><ol><li><p>将 <code>./gitlab-ce_13.8.5-ce.0_amd64.deb</code> 上传到服务器；也可以从这里下载 <code>https://packages.gitlab.com/gitlab/gitlab-ce/packages/ubuntu/focal/gitlab-ce_13.8.5-ce.0_amd64.deb/download.deb</code></p></li><li><p>安装 <code>dpkg -i gitlab-ce_13.8.5-ce.0_amd64.deb</code></p></li></ol><h1 id="h-" class="text-4xl font-header !mt-8 !mb-4 first:!mt-0 first:!mb-0">修改配置</h1><p>安装完成后，程序输出了一个配置文件地址 <code>/etc/gitlab/gitlab.rb</code> ， 将里面的访问地址<code>external_url</code>修改为需要用的</p><pre data-type="codeBlock" text=" external_url &apos;http://yourdomain.com&apos;
"><code> external_url <span class="hljs-symbol">'http</span>:<span class="hljs-comment">//yourdomain.com'</span>
</code></pre><h1 id="h-" class="text-4xl font-header !mt-8 !mb-4 first:!mt-0 first:!mb-0">运行</h1><p>执行 <code>sudo gitlab-ctl reconfigure</code>访问前面配置的 <code>external_url</code>地址，看到已经可以访问控制台，初步配置完成</p><h1 id="h-letsencrypt" class="text-4xl font-header !mt-8 !mb-4 first:!mt-0 first:!mb-0">安全配置-与letsencrypt配合</h1><p>参考：<a target="_blank" rel="noopener noreferrer nofollow ugc" class="dont-break-out" href="https://docs.gitlab.com/omnibus/settings/ssl.html">gitlab官方文档</a>编辑配置文件 <code>vi /etc/gitlab/gitlab.rb</code>设置</p><pre data-type="codeBlock" text="letsencrypt[&apos;enable&apos;] = true             # 开启letsencrypt
external_url &quot;https://yourdomain.com&quot;    # 设置为你的域名 (https)
"><code>letsencrypt[<span class="hljs-string">'enable'</span>] = <span class="hljs-literal">true</span>             <span class="hljs-comment"># 开启letsencrypt</span>
external_url <span class="hljs-string">"https://yourdomain.com"</span>    <span class="hljs-comment"># 设置为你的域名 (https)</span>
</code></pre><p>然后运行<code>sudo gitlab-ctl reconfigure</code>重新加载配置，即可自动申请获得ssl证书</p><p><strong>注意：letsencrypt不支持支持自定义端口，所以我们就用默认的443端口，在配置时需要暂时开放80和443端口，允许letsencrypt访问，才能完成自动配置 配置完成后，由于不再进行http连接，80端口可以永久关闭，但443端口还要在续签的时候开放</strong></p><h1 id="h-" class="text-4xl font-header !mt-8 !mb-4 first:!mt-0 first:!mb-0">续签配置</h1><p>编辑配置文件 <code>vi /etc/gitlab/gitlab.rb</code>设置</p><pre data-type="codeBlock" text="letsencrypt[&apos;auto_renew&apos;] = true # 打开自动续签
letsencrypt[&apos;auto_renew_hour&apos;] = &quot;12&quot;
letsencrypt[&apos;auto_renew_minute&apos;] = &quot;30&quot;
letsencrypt[&apos;auto_renew_day_of_month&apos;] = &quot;*/7&quot;
letsencrypt[&apos;auto_renew_log_directory&apos;] = &apos;/opt/software/gitlab&apos; #指定一个存在的目录，用来放续签日志
"><code>letsencrypt[<span class="hljs-string">'auto_renew'</span>] <span class="hljs-operator">=</span> <span class="hljs-literal">true</span> # 打开自动续签
letsencrypt[<span class="hljs-string">'auto_renew_hour'</span>] <span class="hljs-operator">=</span> <span class="hljs-string">"12"</span>
letsencrypt[<span class="hljs-string">'auto_renew_minute'</span>] <span class="hljs-operator">=</span> <span class="hljs-string">"30"</span>
letsencrypt[<span class="hljs-string">'auto_renew_day_of_month'</span>] <span class="hljs-operator">=</span> <span class="hljs-string">"*/7"</span>
letsencrypt[<span class="hljs-string">'auto_renew_log_directory'</span>] <span class="hljs-operator">=</span> <span class="hljs-string">'/opt/software/gitlab'</span> #指定一个存在的目录，用来放续签日志
</code></pre><p>然后运行</p><pre data-type="codeBlock" text="sudo gitlab-ctl reconfigure
sudo gitlab-ctl renew-le-certs
"><code>sudo gitlab<span class="hljs-operator">-</span>ctl reconfigure
sudo gitlab<span class="hljs-operator">-</span>ctl renew<span class="hljs-operator">-</span>le<span class="hljs-operator">-</span>certs
</code></pre><p>这样程序就会周期性地检查是否需要续签，在证书过期前30天，自动完成续签，注意，续签时需要开放443端口让letsencrypt访问</p><h1 id="h-" class="text-4xl font-header !mt-8 !mb-4 first:!mt-0 first:!mb-0">使用客户端连接</h1><p>下载git客户端 <code>https://git-scm.com/downloads</code></p><h1 id="h-" class="text-4xl font-header !mt-8 !mb-4 first:!mt-0 first:!mb-0">常用操作</h1><p>修改配置后的初始化</p><pre data-type="codeBlock" text="gitlab-ctl reconfigure
"><code>gitlab<span class="hljs-operator">-</span>ctl reconfigure
</code></pre><p>启动</p><pre data-type="codeBlock" text="sudo systemctl start gitlab-runsvdir
sudo gitlab-ctl start
"><code>sudo systemctl <span class="hljs-keyword">start</span> gitlab<span class="hljs-operator">-</span>runsvdir
sudo gitlab<span class="hljs-operator">-</span>ctl <span class="hljs-keyword">start</span>
</code></pre><p>停止 <code>sudo gitlab-ctl stop</code></p><p>重启 <code>sudo gitlab-ctl restart</code></p><p>开机启动 <code>systemctl enable gitlab-runsvdir.service</code></p><p>禁止开机自启动 <code>systemctl disable gitlab-runsvdir.service</code></p><p>备份和恢复</p><p><a target="_blank" rel="noopener noreferrer nofollow ugc" class="dont-break-out" href="https://cloud.tencent.com/developer/article/1622317">Gitlab备份、迁移、恢复和升级</a></p><h1 id="h-" class="text-4xl font-header !mt-8 !mb-4 first:!mt-0 first:!mb-0">用户管理</h1><p><a target="_blank" rel="noopener noreferrer nofollow ugc" class="dont-break-out" href="https://www.cnblogs.com/zangxueyuan/p/9222014.html">Gitlab管理用户、组、权限</a><a target="_blank" rel="noopener noreferrer nofollow ugc" class="dont-break-out" href="https://blog.csdn.net/u012348774/article/details/79134697">Gitlab用户注册及管理</a></p>]]></content:encoded>
            <author>mongo@newsletter.paragraph.com (Mongo)</author>
        </item>
        <item>
            <title><![CDATA[veracrypt安装和使用]]></title>
            <link>https://paragraph.com/@mongo/veracrypt</link>
            <guid>LShKutXIj6mZFx79aAVH</guid>
            <pubDate>Sun, 07 Nov 2021 12:31:20 GMT</pubDate>
            <description><![CDATA[系统版本：Ubuntu 20.04 x64 veracrypt版本：1.1.2 首先将 veracrypt-console-1.24-Update7-Ubuntu-20.04-amd64.deb 文件上传到服务器上 1. 安装： 安装deb文件dpkg -i veracrypt-console-1.24-Update7-Ubuntu-20.04-amd64.deb 输入 veracrypt --version 能看到版本，说明安装成功 2. 创建加密盘： 会创建一个文件型加密盘veracrypt -c 一般创建到 /root/filepass 3. 挂载加密盘：veracrypt -p [你设置的密码] \ --protect-hidden no --non-interactive /root/filepass /opt 4. 卸载加密盘：veracrypt -d /opt]]></description>
            <content:encoded><![CDATA[<p>系统版本：Ubuntu 20.04 x64</p><p>veracrypt版本：1.1.2</p><p>首先将 <em>veracrypt-console-1.24-Update7-Ubuntu-20.04-amd64.deb</em> 文件上传到服务器上</p><p>1. 安装： 安装deb文件</p><pre data-type="codeBlock" text="dpkg -i veracrypt-console-1.24-Update7-Ubuntu-20.04-amd64.deb
"><code>dpkg <span class="hljs-operator">-</span>i veracrypt<span class="hljs-operator">-</span>console<span class="hljs-number">-1.24</span><span class="hljs-operator">-</span>Update7<span class="hljs-operator">-</span>Ubuntu<span class="hljs-number">-20.04</span><span class="hljs-operator">-</span>amd64.deb
</code></pre><p>输入 <code>veracrypt --version</code> 能看到版本，说明安装成功</p><p>2. 创建加密盘： 会创建一个文件型加密盘</p><pre data-type="codeBlock" text="veracrypt -c
"><code>veracrypt <span class="hljs-operator">-</span><span class="hljs-built_in">c</span>
</code></pre><p>一般创建到 /root/filepass</p><p>3. 挂载加密盘：</p><pre data-type="codeBlock" text="veracrypt  -p [你设置的密码] \
--protect-hidden no --non-interactive  /root/filepass  /opt
"><code>veracrypt  <span class="hljs-operator">-</span>p [你设置的密码] \
<span class="hljs-operator">-</span><span class="hljs-operator">-</span>protect<span class="hljs-operator">-</span>hidden no <span class="hljs-operator">-</span><span class="hljs-operator">-</span>non<span class="hljs-operator">-</span>interactive  <span class="hljs-operator">/</span>root<span class="hljs-operator">/</span>filepass  <span class="hljs-operator">/</span>opt
</code></pre><p>4. 卸载加密盘：</p><pre data-type="codeBlock" text="veracrypt -d /opt
"><code>veracrypt <span class="hljs-operator">-</span>d <span class="hljs-operator">/</span>opt
</code></pre>]]></content:encoded>
            <author>mongo@newsletter.paragraph.com (Mongo)</author>
        </item>
        <item>
            <title><![CDATA[certbot安装使用]]></title>
            <link>https://paragraph.com/@mongo/certbot</link>
            <guid>S66rPJkwFaJF5zvRHiAP</guid>
            <pubDate>Sat, 06 Nov 2021 07:57:05 GMT</pubDate>
            <description><![CDATA[certbot可以配合nginx，自动化配置和更新SSL证书 配置环境: Ubuntu 20.04 2核4G内存安装包版本：gitlab-ce_13.8.4 arm64文件系统： linux ext4目录安装前准备下载安装配置nginx用certbot生成证书可能碰到的错误检查新的nginx配置参考资料windows版使用安装前准备确认本机已经安装nginx，并且在编译时添加了ssl模块 --with-http_ssl_module 已经有一个域名，并且将DNS解析到了本机 防火墙打开希望配置的http和https端口，这里以80和443为例下载安装apt-get update sudo apt-get install -y certbot python3-certbot-nginx 配置nginx自己先配置一个http的版本即可，例如server { listen 80 default_server; root /var/www/html; server_name example.com www.example.com; } 重新启动nginxnginx -t && nginx...]]></description>
            <content:encoded><![CDATA[<p>certbot可以配合nginx，自动化配置和更新SSL证书</p><p>配置环境: Ubuntu 20.04 2核4G内存安装包版本：gitlab-ce_13.8.4 arm64文件系统： linux ext4</p><h1 id="h-" class="text-4xl font-header !mt-8 !mb-4 first:!mt-0 first:!mb-0">目录</h1><ul><li><p>安装前准备</p></li><li><p>下载安装</p></li><li><p>配置nginx</p></li><li><p>用certbot生成证书</p><ul><li><p>可能碰到的错误</p></li></ul></li><li><p>检查新的nginx配置</p></li><li><p>参考资料</p></li><li><p>windows版使用</p></li></ul><h2 id="h-" class="text-3xl font-header !mt-8 !mb-4 first:!mt-0 first:!mb-0">安装前准备</h2><p>确认本机已经安装nginx，并且在编译时添加了ssl模块 <code>--with-http_ssl_module</code> 已经有一个域名，并且将DNS解析到了本机 防火墙打开希望配置的http和https端口，这里以80和443为例</p><h2 id="h-" class="text-3xl font-header !mt-8 !mb-4 first:!mt-0 first:!mb-0">下载安装</h2><pre data-type="codeBlock" text="apt-get update
sudo apt-get install -y certbot python3-certbot-nginx
"><code>apt<span class="hljs-operator">-</span>get update
sudo apt<span class="hljs-operator">-</span>get install <span class="hljs-operator">-</span>y certbot python3<span class="hljs-operator">-</span>certbot<span class="hljs-operator">-</span>nginx
</code></pre><h2 id="h-nginx" class="text-3xl font-header !mt-8 !mb-4 first:!mt-0 first:!mb-0">配置nginx</h2><p>自己先配置一个http的版本即可，例如</p><pre data-type="codeBlock" text="server {
    listen 80 default_server;
    root /var/www/html;
    server_name example.com www.example.com;
}
"><code>server {
    listen <span class="hljs-number">80</span> default_server;
    root <span class="hljs-operator">/</span><span class="hljs-keyword">var</span><span class="hljs-operator">/</span>www<span class="hljs-operator">/</span>html;
    server_name example.com www.example.com;
}
</code></pre><p>重新启动nginx<code>nginx -t &amp;&amp; nginx -s reload</code>测试访问<code>http://example.com</code></p><h2 id="h-certbot" class="text-3xl font-header !mt-8 !mb-4 first:!mt-0 first:!mb-0">用certbot生成证书</h2><p><code>sudo certbot --nginx -d example.com -d www.example.com</code></p><h2 id="h-" class="text-3xl font-header !mt-8 !mb-4 first:!mt-0 first:!mb-0">可能碰到的错误</h2><ol><li><p>Could not find a usable &apos;nginx&apos; binary 找不到nginx，是因为没有将nginx放到环境变量中，设置nginx软连接</p><pre data-type="codeBlock" text="ln -s /usr/local/nginx/sbin/nginx /usr/bin/nginx
ln -b /usr/local/nginx/conf/nginx.conf /etc/nginx/nginx.conf
"><code>ln <span class="hljs-operator">-</span>s <span class="hljs-operator">/</span>usr<span class="hljs-operator">/</span>local<span class="hljs-operator">/</span>nginx<span class="hljs-operator">/</span>sbin<span class="hljs-operator">/</span>nginx <span class="hljs-operator">/</span>usr<span class="hljs-operator">/</span>bin<span class="hljs-operator">/</span>nginx
ln <span class="hljs-operator">-</span>b <span class="hljs-operator">/</span>usr<span class="hljs-operator">/</span>local<span class="hljs-operator">/</span>nginx<span class="hljs-operator">/</span>conf<span class="hljs-operator">/</span>nginx.conf <span class="hljs-operator">/</span>etc<span class="hljs-operator">/</span>nginx<span class="hljs-operator">/</span>nginx.conf
</code></pre></li><li><p>Nginx build is missing SSL module (--with-http_ssl_module).</p><p>nginx缺少模块，重新编译nginx</p><pre data-type="codeBlock" text="cd /opt/software/nginx-1.18.0
./configure --with-http_ssl_module
make &amp;&amp; make install
"><code>cd <span class="hljs-operator">/</span>opt<span class="hljs-operator">/</span>software<span class="hljs-operator">/</span>nginx<span class="hljs-number">-1.18</span><span class="hljs-number">.0</span>
./configure <span class="hljs-operator">-</span><span class="hljs-operator">-</span>with<span class="hljs-operator">-</span>http_ssl_module
make <span class="hljs-operator">&#x26;</span><span class="hljs-operator">&#x26;</span> make install
</code></pre></li></ol><p>得到输出</p><pre data-type="codeBlock" text="Congratulations! You have successfully enabled https://example.com and https://www.example.com 

-------------------------------------------------------------------------------------
IMPORTANT NOTES: 

Congratulations! Your certificate and chain have been saved at: 
/etc/letsencrypt/live/example.com/fullchain.pem 
Your key file has been saved at: 
/etc/letsencrypt/live/example.com//privkey.pem
Your cert will expire on 2017-12-12.
"><code>Congratulations<span class="hljs-operator">!</span> You have successfully enabled https:<span class="hljs-comment">//example.com and https://www.example.com </span>

<span class="hljs-operator">-</span><span class="hljs-operator">-</span><span class="hljs-operator">-</span><span class="hljs-operator">-</span><span class="hljs-operator">-</span><span class="hljs-operator">-</span><span class="hljs-operator">-</span><span class="hljs-operator">-</span><span class="hljs-operator">-</span><span class="hljs-operator">-</span><span class="hljs-operator">-</span><span class="hljs-operator">-</span><span class="hljs-operator">-</span><span class="hljs-operator">-</span><span class="hljs-operator">-</span><span class="hljs-operator">-</span><span class="hljs-operator">-</span><span class="hljs-operator">-</span><span class="hljs-operator">-</span><span class="hljs-operator">-</span><span class="hljs-operator">-</span><span class="hljs-operator">-</span><span class="hljs-operator">-</span><span class="hljs-operator">-</span><span class="hljs-operator">-</span><span class="hljs-operator">-</span><span class="hljs-operator">-</span><span class="hljs-operator">-</span><span class="hljs-operator">-</span><span class="hljs-operator">-</span><span class="hljs-operator">-</span><span class="hljs-operator">-</span><span class="hljs-operator">-</span><span class="hljs-operator">-</span><span class="hljs-operator">-</span><span class="hljs-operator">-</span><span class="hljs-operator">-</span><span class="hljs-operator">-</span><span class="hljs-operator">-</span><span class="hljs-operator">-</span><span class="hljs-operator">-</span><span class="hljs-operator">-</span><span class="hljs-operator">-</span><span class="hljs-operator">-</span><span class="hljs-operator">-</span><span class="hljs-operator">-</span><span class="hljs-operator">-</span><span class="hljs-operator">-</span><span class="hljs-operator">-</span><span class="hljs-operator">-</span><span class="hljs-operator">-</span><span class="hljs-operator">-</span><span class="hljs-operator">-</span><span class="hljs-operator">-</span><span class="hljs-operator">-</span><span class="hljs-operator">-</span><span class="hljs-operator">-</span><span class="hljs-operator">-</span><span class="hljs-operator">-</span><span class="hljs-operator">-</span><span class="hljs-operator">-</span><span class="hljs-operator">-</span><span class="hljs-operator">-</span><span class="hljs-operator">-</span><span class="hljs-operator">-</span><span class="hljs-operator">-</span><span class="hljs-operator">-</span><span class="hljs-operator">-</span><span class="hljs-operator">-</span><span class="hljs-operator">-</span><span class="hljs-operator">-</span><span class="hljs-operator">-</span><span class="hljs-operator">-</span><span class="hljs-operator">-</span><span class="hljs-operator">-</span><span class="hljs-operator">-</span><span class="hljs-operator">-</span><span class="hljs-operator">-</span><span class="hljs-operator">-</span><span class="hljs-operator">-</span><span class="hljs-operator">-</span><span class="hljs-operator">-</span><span class="hljs-operator">-</span><span class="hljs-operator">-</span><span class="hljs-operator">-</span>
IMPORTANT NOTES: 

Congratulations<span class="hljs-operator">!</span> Your certificate and chain have been saved at: 
<span class="hljs-operator">/</span>etc<span class="hljs-operator">/</span>letsencrypt<span class="hljs-operator">/</span>live<span class="hljs-operator">/</span>example.com/fullchain.pem 
Your key file has been saved at: 
<span class="hljs-operator">/</span>etc<span class="hljs-operator">/</span>letsencrypt<span class="hljs-operator">/</span>live<span class="hljs-operator">/</span>example.com/<span class="hljs-operator">/</span>privkey.pem
Your cert will expire on <span class="hljs-number">2017</span><span class="hljs-number">-12</span><span class="hljs-number">-12.</span>
</code></pre><p>测试访问 <code>https://example.com</code></p><h2 id="h-nginx" class="text-3xl font-header !mt-8 !mb-4 first:!mt-0 first:!mb-0">检查新的nginx配置</h2><p>看到的应该类似这样</p><pre data-type="codeBlock" text="server {
    listen 80 default_server;
    listen [::]:80 default_server;
    root /var/www/html;
    server_name  example.com www.example.com;

    listen 443 ssl; # managed by Certbot

    # RSA certificate
    ssl_certificate /etc/letsencrypt/live/example.com/fullchain.pem; # managed by Certbot
    ssl_certificate_key /etc/letsencrypt/live/example.com/privkey.pem; # managed by Certbot

    include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot

    # Redirect non-https traffic to https
    if ($scheme != &quot;https&quot;) {
        return 301 https://$host$request_uri;
    } # managed by Certbot
}
"><code>server {
    listen <span class="hljs-number">80</span> default_server;
    listen [::]:<span class="hljs-number">80</span> default_server;
    root <span class="hljs-operator">/</span><span class="hljs-keyword">var</span><span class="hljs-operator">/</span>www<span class="hljs-operator">/</span>html;
    server_name  example.com www.example.com;

    listen <span class="hljs-number">443</span> ssl; # managed by Certbot

    # RSA certificate
    ssl_certificate <span class="hljs-operator">/</span>etc<span class="hljs-operator">/</span>letsencrypt<span class="hljs-operator">/</span>live<span class="hljs-operator">/</span>example.com/fullchain.pem; # managed by Certbot
    ssl_certificate_key <span class="hljs-operator">/</span>etc<span class="hljs-operator">/</span>letsencrypt<span class="hljs-operator">/</span>live<span class="hljs-operator">/</span>example.com/privkey.pem; # managed by Certbot

    include <span class="hljs-operator">/</span>etc<span class="hljs-operator">/</span>letsencrypt<span class="hljs-operator">/</span>options<span class="hljs-operator">-</span>ssl<span class="hljs-operator">-</span>nginx.conf; # managed by Certbot

    # Redirect non<span class="hljs-operator">-</span>https traffic to https
    <span class="hljs-keyword">if</span> ($scheme <span class="hljs-operator">!</span><span class="hljs-operator">=</span> <span class="hljs-string">"https"</span>) {
        <span class="hljs-keyword">return</span> <span class="hljs-number">301</span> https:<span class="hljs-comment">//$host$request_uri;</span>
    } # managed by Certbot
}
</code></pre><h2 id="h-" class="text-3xl font-header !mt-8 !mb-4 first:!mt-0 first:!mb-0">参考资料</h2><p><a target="_blank" rel="noopener noreferrer nofollow ugc" class="dont-break-out" href="https://www.nginx.com/blog/using-free-ssltls-certificates-from-lets-encrypt-with-nginx/">将Let&apos;s Encrypt与NGINX一起使用</a></p><p><a target="_blank" rel="noopener noreferrer nofollow ugc" class="dont-break-out" href="https://my.oschina.net/blueskyer/blog/3220726">nginx免费https证书（certbot）</a></p><h2 id="h-windows" class="text-3xl font-header !mt-8 !mb-4 first:!mt-0 first:!mb-0">windows版使用</h2><p>按照这两个文档配置即可</p><p><a target="_blank" rel="noopener noreferrer nofollow ugc" class="dont-break-out" href="https://certbot.eff.org/lets-encrypt/windows-nginx">官方文档</a></p><p><a target="_blank" rel="noopener noreferrer nofollow ugc" class="dont-break-out" href="https://letsencrypt.org/zh-cn/docs/challenge-types/">域名验证方式</a></p><p>运行</p><pre data-type="codeBlock" text="certbot certonly --webroot
"><code>certbot certonly <span class="hljs-operator">-</span><span class="hljs-operator">-</span>webroot
</code></pre>]]></content:encoded>
            <author>mongo@newsletter.paragraph.com (Mongo)</author>
            <enclosure url="https://storage.googleapis.com/papyrus_images/7d85d23eda3baa6a056e43bc46694124bc433b388c3b985b6461d055f96e6357.png" length="0" type="image/png"/>
        </item>
    </channel>
</rss>