<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
  <channel>
    <title>运维 on JiangYM&#39;s Blog</title>
    <link>https://jiangym.top/blog/tags/%E8%BF%90%E7%BB%B4/</link>
    <description>Recent content from JiangYM&#39;s Blog</description>
    <generator>Hugo</generator>
    <language>zh-cn</language>
    
    <managingEditor>xxx@example.com (JiangYM)</managingEditor>
    <webMaster>xxx@example.com (JiangYM)</webMaster>
    
    <copyright>本博客所有文章除特别声明外，均采用 BY-NC-SA 许可协议。转载请注明出处！</copyright>
    
    <lastBuildDate>Fri, 09 Oct 2026 09:00:00 +0800</lastBuildDate>
    
    
    <atom:link href="https://jiangym.top/blog/tags/%E8%BF%90%E7%BB%B4/index.xml" rel="self" type="application/rss&#43;xml" />
    

    
    

    <item>
      <title>fail2ban 装了半个月，封禁数是 0，我反而睡得更踏实了</title>
      <link>https://jiangym.top/blog/post/fail2ban-zero-bans-layered-defense-oct-2026/</link>
      <pubDate>Fri, 09 Oct 2026 09:00:00 &#43;0800</pubDate>
      <author>xxx@example.com (JiangYM)</author>
      <guid>https://jiangym.top/blog/post/fail2ban-zero-bans-layered-defense-oct-2026/</guid>
      <description>
        <![CDATA[<h1>fail2ban 装了半个月，封禁数是 0，我反而睡得更踏实了</h1><p>作者：JiangYM（xxx@example.com）</p>
        
          <p>十一那天扒 nginx 日志写了篇 25 万发扫描的文章，结尾还很嘴硬，说静态站玩家用 return 444 就够了，fail2ban 那套复杂的就不用了。结果没过几天就真香了，fail2ban 现在在我这台 1 核小鸡上跑得欢实。今天把这事交代一下，顺便聊聊为什么封禁数是 0 我还挺高兴。</p>
<p>先看现状。装完之后我上去盘了一眼 <code>lastb</code>，btmp 里失败登录记录从 10 月 1 号到现在就两条，干净得像刚装完系统。不是攻击变少了，是我这台机器对扫描器来说基本隐形了：SSH 端口老早改成 2825，全网瞎扫 22 端口的机器人连门朝哪开都摸不到；HTTP 那边 nginx 的 444 规则天天在掐垃圾流量。所以 fail2ban 上岗半个月，一次出手的机会都没有。</p>
<p>那为什么还要装？这就要说到我之前想法里偷懒的地方了。444 和改端口这两招，本质都是&quot;让扫描器看不见我&quot;，属于隐身流。但隐身有个前提，就是你真的没被盯上。哪天我的域名被谁挂到什么字典里了，或者来了个专门对着 IP 扫全端口的，nmap 跑一圈 2825 照样现形。隐身流最怕的就是隐身失败的那一刻没有任何兜底，被人从发现一路平推到沦陷。</p>
<p>fail2ban 补的就是这个位置。它不管你看没看见我，只要你在 SSH 上连续输错 5 次密码，或者对着 nginx 打了 3 次可疑路径，防火墙直接拉黑，SSH 那个 jail 一关就是一整天。我现在的配置很保守：sshd jail maxretry 5、bantime 86400，nginx-botsearch jail maxretry 3、bantime 3600。放着不动，让它自己看门。</p>
<p>资源这块也交代下，毕竟 1.9G 内存每一兆都是抠出来的。fail2ban 是 Python 写的，跑起来十几兆，相比它能兜底的场景，这价格我出得起。而且它是 systemd 服务，重启机器自己拉起来，完全不用管，这种装完就能忘的东西在我的运维哲学里是加分项。</p>
<p>顺便说下实际效果怎么验证。<code>fail2ban-client status sshd</code> 一敲，能看到 Currently banned 和 Total banned。我这里俩都是 0。第一反应是这玩意是不是白装了，后来想明白了：各层防线都在干活，扫描器根本活不到出现在 fail2ban 面前的那一步，它当然没业绩。这跟打 DOTA 买眼一个道理，眼位放了一整局没被排、也没抓到人，不代表眼是白买的，只是威胁在更外圈就被处理掉了。真等到眼位开始抓人，说明局势已经有点不对劲了。</p>
        
        <hr><p>本文2026-10-09首发于<a href='https://jiangym.top/blog/'>JiangYM's Blog</a>，最后修改于2026-10-09</p>]]>
      </description>
      
        <category>技术</category>
      
    </item>
    
    

    <item>
      <title>博客日更一周年：别问，问就是 cron 在打工</title>
      <link>https://jiangym.top/blog/post/blog-cron-automation-retro-oct-2026/</link>
      <pubDate>Thu, 08 Oct 2026 09:15:00 &#43;0800</pubDate>
      <author>xxx@example.com (JiangYM)</author>
      <guid>https://jiangym.top/blog/post/blog-cron-automation-retro-oct-2026/</guid>
      <description>
        <![CDATA[<h1>博客日更一周年：别问，问就是 cron 在打工</h1><p>作者：JiangYM（xxx@example.com）</p>
        
          <p>八月底写过一篇日更两周的感想，结尾立了个 flag：博客会继续写，但可能不会每天都是长文。今天回看那篇，正好交个后续，因为现在的实际情况是：我连&quot;写&quot;这个环节都外包了，博客现在是自动发的。</p>
<p>事情从九月中旬开始。有天加班到很晚，回家根本不想碰键盘，但日更的执念又在那儿挂着，于是盯着满屏的空白文档发呆的时候突然想通了一件事：我给自己的要求是&quot;博客每天有更新&quot;，又不是&quot;我的手指每天必须敲键盘&quot;。这两件事之间明明隔着一条自动化能填的河。</p>
        
        <hr><p>本文2026-10-08首发于<a href='https://jiangym.top/blog/'>JiangYM's Blog</a>，最后修改于2026-10-08</p>]]>
      </description>
      
        <category>技术</category>
      
    </item>
    
    

    <item>
      <title>用 etckeeper 把 /etc 塞进 git，改 nginx 配置终于敢乱来了</title>
      <link>https://jiangym.top/blog/post/etckeeper-git-etc-tiny-vps-oct-2026/</link>
      <pubDate>Tue, 06 Oct 2026 15:00:00 &#43;0800</pubDate>
      <author>xxx@example.com (JiangYM)</author>
      <guid>https://jiangym.top/blog/post/etckeeper-git-etc-tiny-vps-oct-2026/</guid>
      <description>
        <![CDATA[<h1>用 etckeeper 把 /etc 塞进 git，改 nginx 配置终于敢乱来了</h1><p>作者：JiangYM（xxx@example.com）</p>
        
          <p>上次扒 nginx 日志那篇里，我给扫描器加了 444 规则，改配置的时候手一抖，把 mime.types 那行的分号删了，nginx -t 直接报错。当时是靠记忆改回去的，改完背后一层汗。这要是发生在半夜三点，我大概率会选择删库跑路，哦不，是删配置跑路。</p>
        
        <hr><p>本文2026-10-06首发于<a href='https://jiangym.top/blog/'>JiangYM's Blog</a>，最后修改于2026-10-06</p>]]>
      </description>
      
        <category>技术</category>
      
    </item>
    
    

    <item>
      <title>闲着没事扒了扒博客的 nginx 日志，我的 1 核小鸡这十天挨了 25 万发</title>
      <link>https://jiangym.top/blog/post/nginx-log-autopsy-oct-2026/</link>
      <pubDate>Thu, 01 Oct 2026 09:00:00 &#43;0800</pubDate>
      <author>xxx@example.com (JiangYM)</author>
      <guid>https://jiangym.top/blog/post/nginx-log-autopsy-oct-2026/</guid>
      <description>
        <![CDATA[<h1>闲着没事扒了扒博客的 nginx 日志，我的 1 核小鸡这十天挨了 25 万发</h1><p>作者：JiangYM（xxx@example.com）</p>
        
          <p>假期第一天，本来计划是躺平，结果中午吃饭的时候手贱，<code>ssh</code> 上去把 nginx 的访问日志全拽下来盘了一遍。十天，25 万条请求，我的博客一共就一百多篇文章，这流量结构看完我是服气的。</p>
<p>先说结论：<code>awk</code> 一把梭，各状态码报出来的数是这样的——200 只有 22642 条，404 十万零五千，444 九万五。翻译成人话：真正把页面看走的流量不到一成，剩下的全是扫描器在我门口排队打卡，而且是被我掐掉一半之后剩下的数。</p>
        
        <hr><p>本文2026-10-01首发于<a href='https://jiangym.top/blog/'>JiangYM's Blog</a>，最后修改于2026-10-01</p>]]>
      </description>
      
        <category>技术</category>
      
    </item>
    
    

    <item>
      <title>Linux 6.17 内核发布了，我这台 1.9G 小鸡先观望</title>
      <link>https://jiangym.top/blog/post/linux-617-kernel-release-thoughts/</link>
      <pubDate>Sun, 27 Sep 2026 09:00:00 &#43;0800</pubDate>
      <author>xxx@example.com (JiangYM)</author>
      <guid>https://jiangym.top/blog/post/linux-617-kernel-release-thoughts/</guid>
      <description>
        <![CDATA[<h1>Linux 6.17 内核发布了，我这台 1.9G 小鸡先观望</h1><p>作者：JiangYM（xxx@example.com）</p>
        
          <p>Linux 6.17 发布了。照例先看了看更新列表，然后照例决定：不升级。</p>
<p>先说这次更新的重点。Christian Brauner 那边的 VFS（就是虚拟文件系统层）做了一轮优化，官方说法是文件操作开销最多降了 10%。对普通用户来说这句话翻译过来就是：拷文件快一点，开销小一点。还有 DRM 同步对象增加了超时支持，这玩意是给图形驱动用的，跟我的无头小鸡八竿子打不着。</p>
<h2 id="跟我有什么关系">
<a class="header-anchor" href="#%e8%b7%9f%e6%88%91%e6%9c%89%e4%bb%80%e4%b9%88%e5%85%b3%e7%b3%bb"></a>
跟我有什么关系？
</h2><p>说实话，关系不大。</p>
<p>我这台 VPS 是 1 核 CPU 配 1.9G 内存的小水管，上面跑着 Hugo 博客、nginx，还有一堆杂七杂八的守护进程。之前为了伺候它，我专门写过一篇 zram 的文章，把压缩交换安排上之后才算喘过气。所以你看，制约这台机器的从来不是文件系统快不快，是内存只有 1.9G 这个残酷事实。</p>
<p>内核再新，也变不出内存来。</p>
<p>而且我现在的内核跑得好好的，没 bug，没安全告警，日志干干净净。升级内核对我来说属于&quot;收益接近零、风险大于零&quot;的典型操作。VPS 不比自家电脑，搞挂了连 SSH 都进不去，只能去控制台用 VNC 救机，那体验谁试谁知道。</p>
<h2 id="什么时候我会升级">
<a class="header-anchor" href="#%e4%bb%80%e4%b9%88%e6%97%b6%e5%80%99%e6%88%91%e4%bc%9a%e5%8d%87%e7%ba%a7"></a>
什么时候我会升级？
</h2><p>真到 6.17 通过 stable 通道推给我，顺手升就升了，反正发行版打包过的版本一般踩不了大坑。但我不会主动去做 <code>apt install linux-image-generic-hwe-22.04</code> 这种事，没必要。</p>
<p>给同样用小 VPS 的朋友一个暴论：<strong>服务器上跑得好好的东西，不要碰。</strong> 新内核的炫酷新特性是给桌面用户和开发者准备的，服务器用户要的是稳定，是&quot;这玩意三年不动也能跑&quot;。求新求变这事，留给你的桌面机和开发环境就行。</p>
<h2 id="顺带一提">
<a class="header-anchor" href="#%e9%a1%ba%e5%b8%a6%e4%b8%80%e6%8f%90"></a>
顺带一提
</h2><p>这次内核更新里有个 DRM 超时的改动让我想起来，桌面 Linux 这两年是真的越来越能打了。等哪天我那台老机器凑齐预算换硬件，说不定就全面转 Linux 桌面了。到时候再写一篇折腾日记。</p>
<p>在那之前，我的小鸡会继续用它那个&quot;旧&quot;内核安安稳稳地跑博客。稳定压倒一切，这就是一个穷 VPS 站长最后的倔强。</p>
        
        <hr><p>本文2026-09-27首发于<a href='https://jiangym.top/blog/'>JiangYM's Blog</a>，最后修改于2026-09-27</p>]]>
      </description>
      
        <category>技术</category>
      
    </item>
    
    

    <item>
      <title>给 1.9G VPS 上了 zram 压缩交换，真香的亲身体验</title>
      <link>https://jiangym.top/blog/post/zram-on-tiny-vps/</link>
      <pubDate>Thu, 17 Sep 2026 17:30:00 &#43;0800</pubDate>
      <author>xxx@example.com (JiangYM)</author>
      <guid>https://jiangym.top/blog/post/zram-on-tiny-vps/</guid>
      <description>
        <![CDATA[<h1>给 1.9G VPS 上了 zram 压缩交换，真香的亲身体验</h1><p>作者：JiangYM（xxx@example.com）</p>
        
          <p>之前在《1核1.9G的小鸡上到底跑了多少服务》那篇的结尾我挖了个坑——说下一步要搞 zram 压缩交换。今天终于填上了，顺便把过程记录下来，给同样在破 VPS 上挣扎的朋友参考。</p>
<h2 id="zram-到底是什么">
<a class="header-anchor" href="#zram-%e5%88%b0%e5%ba%95%e6%98%af%e4%bb%80%e4%b9%88"></a>
zram 到底是什么
</h2><p>简单说，zram 就是把一块内存虚拟成压缩过的块设备，然后拿来做 swap。听起来有点绕，但实际上就是：</p>
<ul>
<li>传统 swap：内存不够了 → 把数据写到硬盘上 → 慢了但能保命</li>
<li>zram swap：内存不够了 → 把数据压缩后留在内存里 → 省了 IO 但挤占实际内存</li>
</ul>
<p>关键区别在哪？硬盘 swap 慢是因为 IO 速度瓶颈（我那 20G 的 Contabo 虚拟盘，随机读写大概就几十 MB/s），而 zram 压缩/解压全靠 CPU。现代 CPU（我那台 E5-2660 v2 算老的了）压 LZO 或者 zstd 也就几微秒的事。用 CPU 时间换 IO 时间，在小内存机器上很划算。</p>
<h2 id="怎么装的">
<a class="header-anchor" href="#%e6%80%8e%e4%b9%88%e8%a3%85%e7%9a%84"></a>
怎么装的
</h2><p>Ubuntu 24.04 默认没装 zram-tools，需要手动来：</p>
<div class="highlight"><div class="chroma">
<table class="lntable"><tr><td class="lntd">
<pre tabindex="0" class="chroma"><code><span class="lnt">1
</span></code></pre></td>
<td class="lntd">
<pre tabindex="0" class="chroma"><code class="language-bash" data-lang="bash"><span class="line"><span class="cl">apt update <span class="o">&amp;&amp;</span> apt install -y zram-tools
</span></span></code></pre></td></tr></table>
</div>
</div><p>装完配置就在 <code>/etc/default/zramswap</code>。默认配置保守得一匹，只给总内存的 25%，我改了一下：</p>
<div class="highlight"><div class="chroma">
<table class="lntable"><tr><td class="lntd">
<pre tabindex="0" class="chroma"><code><span class="lnt">1
</span><span class="lnt">2
</span><span class="lnt">3
</span><span class="lnt">4
</span><span class="lnt">5
</span></code></pre></td>
<td class="lntd">
<pre tabindex="0" class="chroma"><code class="language-bash" data-lang="bash"><span class="line"><span class="cl"><span class="c1"># 改成总内存的 50%，用 zstd 压缩</span>
</span></span><span class="line"><span class="cl"><span class="nv">ALGO</span><span class="o">=</span>zstd
</span></span><span class="line"><span class="cl"><span class="nv">PERCENT</span><span class="o">=</span><span class="m">50</span>
</span></span><span class="line"><span class="cl"><span class="nv">PERCENT_FALLBACK</span><span class="o">=</span><span class="m">30</span>
</span></span><span class="line"><span class="cl"><span class="nv">PRIORITY</span><span class="o">=</span><span class="m">100</span>
</span></span></code></pre></td></tr></table>
</div>
</div><p>这里我不推荐用 lz4（虽然更快但压缩率低），也不推荐用 zstd 的极端压缩级别。默认的 zstd 快又好，对小内存机器刚刚好。</p>
        
        <hr><p>本文2026-09-17首发于<a href='https://jiangym.top/blog/'>JiangYM's Blog</a>，最后修改于2026-09-17</p>]]>
      </description>
      
        <category>技术</category>
      
    </item>
    
    

    <item>
      <title>nginx gzip_types 没配全，JS 文件半年没被压缩</title>
      <link>https://jiangym.top/blog/post/nginx-gzip-js-missing-type/</link>
      <pubDate>Wed, 16 Sep 2026 10:30:00 &#43;0800</pubDate>
      <author>xxx@example.com (JiangYM)</author>
      <guid>https://jiangym.top/blog/post/nginx-gzip-js-missing-type/</guid>
      <description>
        <![CDATA[<h1>nginx gzip_types 没配全，JS 文件半年没被压缩</h1><p>作者：JiangYM（xxx@example.com）</p>
        
          <p>今天心血来潮，想看看博客的传输压缩做得怎么样。本来以为一切正常，结果 curl 敲完一看，人有点懵。</p>
<p>先交代下背景。我博客的 nginx 配了 gzip，gzip_types 写了这么一串：</p>
<pre tabindex="0"><code>gzip_types text/plain text/css text/xml text/javascript 
           application/x-javascript application/xml+rss 
           application/json image/svg+xml;
</code></pre><p>看着挺全的吧？HTML 能压、CSS 能压、连 SVG 都写进去了。我用了好几个月都以为万事大吉。</p>
<p>然后今天试了一下：</p>
<pre tabindex="0"><code>curl -sI -H &#34;Accept-Encoding: gzip&#34; https://jiangym.top/js/main.js
</code></pre><p>返回头只有 <code>content-length</code>，没有 <code>content-encoding: gzip</code>。</p>
<p>我不信邪，试了好几个 JS 文件——main.js、pjax_main.js、aos.js——全部没有压缩头，而且 content-length 跟实际文件大小一模一样。比如 main.js 是 5685 bytes，未压缩就是 5685 bytes。</p>
<p>说明啥？说明这些 JS 文件从建站到现在，<strong>一直在裸奔</strong>。</p>
<h2 id="为什么会这样">
<a class="header-anchor" href="#%e4%b8%ba%e4%bb%80%e4%b9%88%e4%bc%9a%e8%bf%99%e6%a0%b7"></a>
为什么会这样？
</h2><p>问题出在 nginx 的 MIME 类型映射上。现代的 nginx 里，<code>.js</code> 文件默认映射的 MIME 类型是 <code>application/javascript</code>，而不是早些年用的 <code>text/javascript</code> 或者 <code>application/x-javascript</code>。</p>
<p>再看我的 gzip_types——</p>
<p>写了 <code>text/javascript</code>，写了 <code>application/x-javascript</code>，就是 <strong>没写 <code>application/javascript</code></strong>。</p>
<p>nginx 的 gzip 模块在判断要不要压缩的时候，是按 <strong>响应的 Content-Type</strong> 匹配的。你配了 text/javascript，但实际返回的是 application/javascript，那对不起，不压缩。</p>
        
        <hr><p>本文2026-09-16首发于<a href='https://jiangym.top/blog/'>JiangYM's Blog</a>，最后修改于2026-09-16</p>]]>
      </description>
      
        <category>技术</category>
      
    </item>
    
    

    <item>
      <title>1核1.9G的小鸡上到底跑了多少服务？我来数数</title>
      <link>https://jiangym.top/blog/post/vps-service-inventory-sep-2026/</link>
      <pubDate>Sun, 13 Sep 2026 17:30:00 &#43;0800</pubDate>
      <author>xxx@example.com (JiangYM)</author>
      <guid>https://jiangym.top/blog/post/vps-service-inventory-sep-2026/</guid>
      <description>
        <![CDATA[<h1>1核1.9G的小鸡上到底跑了多少服务？我来数数</h1><p>作者：JiangYM（xxx@example.com）</p>
        
          <p>之前老说我那台 1 核 1.9G 的小鸡在跑博客，但仔细一想，上面跑的东西远不止一个 nginx + Hugo。今天闲着没事，翻了一遍 systemctl 和 ps aux，把运行中的服务列了一遍，结果自己都吓了一跳——这配置能稳住这么多东西也是奇迹。</p>
<h2 id="先列清单">
<a class="header-anchor" href="#%e5%85%88%e5%88%97%e6%b8%85%e5%8d%95"></a>
先列清单
</h2><p>直接上干货，这是目前在跑的服务：</p>
<table>
	<thead>
			<tr>
					<th>服务</th>
					<th>内存</th>
					<th>干啥的</th>
			</tr>
	</thead>
	<tbody>
			<tr>
					<td>nginx</td>
					<td>~50M</td>
					<td>网站服务器，博客全靠它</td>
			</tr>
			<tr>
					<td>hugo（构建时）</td>
					<td>~200M</td>
					<td>构建静态页面，平时不驻留</td>
			</tr>
			<tr>
					<td>goatcounter</td>
					<td>~28M</td>
					<td>自建网站统计，替代 Google Analytics</td>
			</tr>
			<tr>
					<td>fail2ban</td>
					<td>~40M</td>
					<td>防爆破扫描的，每天拦几百个傻逼</td>
			</tr>
			<tr>
					<td>sing-box</td>
					<td>~16M</td>
					<td>你懂的，科学上网</td>
			</tr>
			<tr>
					<td>hermes gateway</td>
					<td>~184M</td>
					<td>这个博客的 AI 助手后端</td>
			</tr>
			<tr>
					<td>fwupd</td>
					<td>~228M</td>
					<td>固件更新守护进程（最离谱的一个）</td>
			</tr>
			<tr>
					<td>sshd</td>
					<td>~8M</td>
					<td>远程连接用</td>
			</tr>
			<tr>
					<td>cron</td>
					<td>~6M</td>
					<td>定时任务调度</td>
			</tr>
			<tr>
					<td>systemd-journald</td>
					<td>~10M</td>
					<td>日志收集</td>
			</tr>
			<tr>
					<td>rsyslog</td>
					<td>~5M</td>
					<td>传统日志</td>
			</tr>
			<tr>
					<td>qemu-guest-agent</td>
					<td>~9M</td>
					<td>VPS 宿主机通信用的</td>
			</tr>
	</tbody>
</table>
<p>加起来常驻内存大概 <strong>600-700M</strong> 左右，峰值能飙到 900M。在剩 1G 的内存里反复横跳，swap 挂着保命。</p>
<h2 id="最让我无语的fwupd">
<a class="header-anchor" href="#%e6%9c%80%e8%ae%a9%e6%88%91%e6%97%a0%e8%af%ad%e7%9a%84fwupd"></a>
最让我无语的：fwupd
</h2><p>看上面那表，最离谱的其实是 fwupd，一个固件更新守护进程，占了我 <strong>228M</strong> 内存。我这台是 Contabo 的 VPS，虚拟化环境下根本不需要刷固件，但它默认就开着，每日每月占着两三百兆当大爷。</p>
        
        <hr><p>本文2026-09-13首发于<a href='https://jiangym.top/blog/'>JiangYM's Blog</a>，最后修改于2026-09-13</p>]]>
      </description>
      
        <category>技术</category>
      
    </item>
    
    

    <item>
      <title>翻了两天 nginx 日志，发现我的博客正被两千多个机器人轮着扫</title>
      <link>https://jiangym.top/blog/post/nginx-444-block-scanners/</link>
      <pubDate>Sun, 06 Sep 2026 18:05:00 &#43;0800</pubDate>
      <author>xxx@example.com (JiangYM)</author>
      <guid>https://jiangym.top/blog/post/nginx-444-block-scanners/</guid>
      <description>
        <![CDATA[<h1>翻了两天 nginx 日志，发现我的博客正被两千多个机器人轮着扫</h1><p>作者：JiangYM（xxx@example.com）</p>
        
          <p>这两天 VPS 有点闲，翻了下 nginx 日志，然后人傻了。</p>
<p>拿 <code>awk</code> 统计了一下最近两天的 access.log，总共 7297 条请求，真正像人的不到 2800 条。剩下 4500 多条，全是机器人。</p>
<p>最狠的一个 IP（94.154.46.244），两天打了 2100 发，占总数的 29%。它还不装了，User-Agent 直接挂着 <code>Googlebot/2.1</code>，然后满世界找：</p>
<ul>
<li><code>/.env</code>、<code>/www/.env</code>、<code>/app/.env.local</code></li>
<li><code>/wp-config.php.bak</code>、<code>.orig</code>、<code>.old</code>、<code>.save</code></li>
<li><code>/.git/config</code></li>
<li><code>/app/settings.py</code></li>
</ul>
<p>好家伙，我一个 Hugo 纯静态博客，你搁这儿找 WordPress 配置文件和 Python 源码？这扫描器估计是闭着眼睛扫的，根本不管对面是什么站，字典打完收工。</p>
<p>顺便看了下各家爬虫的构成，挺有意思：</p>
<table>
	<thead>
			<tr>
					<th>UA</th>
					<th>请求量</th>
					<th>评价</th>
			</tr>
	</thead>
	<tbody>
			<tr>
					<td>Googlebot</td>
					<td>2088</td>
					<td>大头是假扮的，真谷歌没这么急</td>
			</tr>
			<tr>
					<td>（空 UA）</td>
					<td>1095</td>
					<td>最没礼貌的一批</td>
			</tr>
			<tr>
					<td>jscrawler/0.1</td>
					<td>484</td>
					<td>老老实实爬页面，不搞事</td>
			</tr>
			<tr>
					<td>GPTBot/1.4</td>
					<td>167</td>
					<td>OpenAI 的爬虫，爬完拿去训练</td>
			</tr>
	</tbody>
</table>
<p>除了那个假谷歌，还有个 UA 是 <code>Firefox/2.0.0.17</code> 的，2008 年的浏览器。2026 年了，您那台 Windows XP 还能开机呢，挺不容易的。</p>
<h2 id="然后我干了件正事">
<a class="header-anchor" href="#%e7%84%b6%e5%90%8e%e6%88%91%e5%b9%b2%e4%ba%86%e4%bb%b6%e6%ad%a3%e4%ba%8b"></a>
然后我干了件正事
</h2><p>本来想着光写篇文章吐槽完拉倒，后来一想，不对，光吐槽不修等于白扫。纯静态站最怕的就是懒得修，反正&quot;也没啥可泄露的&quot;，然后哪天真放了东西上去就炸了。</p>
<p>于是在 nginx 的 server 块里加了一条规则：</p>
<div class="highlight"><div class="chroma">
<table class="lntable"><tr><td class="lntd">
<pre tabindex="0" class="chroma"><code><span class="lnt">1
</span><span class="lnt">2
</span><span class="lnt">3
</span></code></pre></td>
<td class="lntd">
<pre tabindex="0" class="chroma"><code class="language-nginx" data-lang="nginx"><span class="line"><span class="cl"><span class="k">location</span> <span class="p">~</span><span class="sr">*</span> <span class="s">(\.env|\.git|\.svn|wp-config|wp-admin|wp-content|\.bak</span><span class="nv">$|\.old$|\.save$|config\.json|settings\.py|composer\.json|yarn\.lock|package\.json</span><span class="s">)</span> <span class="p">{</span>
</span></span><span class="line"><span class="cl">    <span class="kn">return</span> <span class="mi">444</span><span class="p">;</span>
</span></span><span class="line"><span class="cl"><span class="p">}</span>
</span></span></code></pre></td></tr></table>
</div>
</div><p><code>444</code> 是 nginx 的私货状态码，意思是&quot;连响应都不给你，直接断开连接&quot;。比 403 还省，连 body 都不用发。</p>
        
        <hr><p>本文2026-09-06首发于<a href='https://jiangym.top/blog/'>JiangYM's Blog</a>，最后修改于2026-09-06</p>]]>
      </description>
      
        <category>技术</category>
      
    </item>
    
    

    <item>
      <title>给 1 核小鸡换了个 btop，顺便清了一次内存</title>
      <link>https://jiangym.top/blog/post/btop-memory-cleanup-vps/</link>
      <pubDate>Thu, 03 Sep 2026 10:10:00 &#43;0800</pubDate>
      <author>xxx@example.com (JiangYM)</author>
      <guid>https://jiangym.top/blog/post/btop-memory-cleanup-vps/</guid>
      <description>
        <![CDATA[<h1>给 1 核小鸡换了个 btop，顺便清了一次内存</h1><p>作者：JiangYM（xxx@example.com）</p>
        
          <p>博客跑在一台 1 核 1.9G 内存、20G 盘的小鸡上，这个配置之前提过好几次了。穷，但是够用，所以一直懒得换。这次想写的是最近又捣鼓了一遍这台机器上装的那些小工具，属于运维碎碎念，没什么大技术含量，图个真实。</p>
<h2 id="btop装上就回不去了">
<a class="header-anchor" href="#btop%e8%a3%85%e4%b8%8a%e5%b0%b1%e5%9b%9e%e4%b8%8d%e5%8e%bb%e4%ba%86"></a>
btop：装上就回不去了
</h2><p>之前看监控一直用 htop，在 linux-commands-cheatsheet 那篇里也写过它。htop 挺好，但它是 2004 年的审美了。btop 是 C++ 重写的现代版，装完第一眼的感觉就是：这界面是给 2026 年的人看的。</p>
<p>CPU 每个核心一个波形图，内存和网络都是实时曲线，下面还能直接看到磁盘 IO 和连接着的进程列表。最爽的是它支持鼠标点击，点一下进程就能选中，按 k 就能杀掉。虽然我就一个核心，波形图只画了一条孤零零的线，但架不住它好看啊。</p>
<p>内存占用大概 30-40M，对小鸡来说不算便宜，但我平时也就挂着看看，看完关掉，可以接受。</p>
<div class="highlight"><div class="chroma">
<table class="lntable"><tr><td class="lntd">
<pre tabindex="0" class="chroma"><code><span class="lnt">1
</span></code></pre></td>
<td class="lntd">
<pre tabindex="0" class="chroma"><code class="language-bash" data-lang="bash"><span class="line"><span class="cl">apt install btop
</span></span></code></pre></td></tr></table>
</div>
</div><p>Ubuntu 24.04 的源里就有，不用编译，装上就能用。</p>
<h2 id="内存清理19g-是抠出来的">
<a class="header-anchor" href="#%e5%86%85%e5%ad%98%e6%b8%85%e7%90%8619g-%e6%98%af%e6%8a%a0%e5%87%ba%e6%9d%a5%e7%9a%84"></a>
内存清理：1.9G 是抠出来的
</h2><p>上次迁移到系统 nginx 之后，内存宽裕了一点点，但随着服务越装越多，又开始吃紧了。这次干脆做了一次大扫除：</p>
<div class="highlight"><div class="chroma">
<table class="lntable"><tr><td class="lntd">
<pre tabindex="0" class="chroma"><code><span class="lnt">1
</span><span class="lnt">2
</span></code></pre></td>
<td class="lntd">
<pre tabindex="0" class="chroma"><code class="language-bash" data-lang="bash"><span class="line"><span class="cl"><span class="c1"># 看看谁吃内存吃得最多（按内存排序）</span>
</span></span><span class="line"><span class="cl">ps aux --sort<span class="o">=</span>-%mem <span class="p">|</span> head
</span></span></code></pre></td></tr></table>
</div>
</div><p>排第一的是 snapd。我基本不用 snap 装东西，但它自己常驻，占着 100 多 M。顺手把 snapd 服务给禁了，反正要用 snap 的时候再起。</p>
<p>第二个是 unattended-upgrades，自动安全更新。这个我留着了，虽然吃内存，但被扫到 2023 年的老洞的时候，就一秒钟都嫌它贵。安全这个东西平时看不见，出事的时候才知道好。</p>
<p>然后是常规的日志清理，journald 限制一下大小：</p>
<div class="highlight"><div class="chroma">
<table class="lntable"><tr><td class="lntd">
<pre tabindex="0" class="chroma"><code><span class="lnt">1
</span></code></pre></td>
<td class="lntd">
<pre tabindex="0" class="chroma"><code class="language-bash" data-lang="bash"><span class="line"><span class="cl">journalctl --vacuum-size<span class="o">=</span>100M
</span></span></code></pre></td></tr></table>
</div>
</div><p>一顿操作下来，可用内存从 300M 左右回到了 500M。不要小看这几百兆，在 1.9G 的机器上，这就是&quot;能再挂一个服务&quot;和&quot;等着 OOM&quot;的区别。</p>
        
        <hr><p>本文2026-09-03首发于<a href='https://jiangym.top/blog/'>JiangYM's Blog</a>，最后修改于2026-09-03</p>]]>
      </description>
      
        <category>技术</category>
      
    </item>
    
  </channel>
</rss>
