<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
xmlns:content="http://purl.org/rss/1.0/modules/content/"
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
xmlns:atom="http://www.w3.org/2005/Atom"
xmlns:wfw="http://wellformedweb.org/CommentAPI/">
<channel>
<title>Hello World</title>
<link>https://xmix.one/</link>
<atom:link href="https://xmix.one/feed/" rel="self" type="application/rss+xml" />
<language>zh-CN</language>
<description>Your description here.</description>
<lastBuildDate>Sun, 21 Jun 2026 00:48:28 +0000</lastBuildDate>
<pubDate>Sun, 21 Jun 2026 00:48:28 +0000</pubDate>
<item>
<title>Debian 手动安装 LNMP</title>
<link>https://xmix.one/archives/73/</link>
<guid>https://xmix.one/archives/73/</guid>
<pubDate>Mon, 08 Jan 2024 16:02:00 +0000</pubDate>
<dc:creator>冷清寒</dc:creator>
<category><![CDATA[默认分类]]></category>
<description><![CDATA[一、环境准备1.更新软件源apt update2.UFW 防火墙放行网站服务端口ufw allow httpufw allow https二、安装最新版 nginx因为 Debian 软件源中的...]]></description>
<content:encoded xml:lang="zh-CN"><![CDATA[
<h2>一、环境准备</h2><h3>1.更新软件源</h3><pre><code>apt update</code></pre><h3>2.UFW 防火墙放行网站服务端口</h3><pre><code>ufw allow http
ufw allow https</code></pre><h2>二、安装最新版 nginx</h2><p>因为 Debian 软件源中的 nginx 实在是太老了，这里选择通过 nginx 官方仓库安装。<br>官方教程：<a href="https://nginx.org/en/linux_packages.html#instructions">https://nginx.org/en/linux_packages.html#instructions</a></p><h3>1.安装必备组件</h3><pre><code>apt install -y curl gnupg2 ca-certificates lsb-release debian-archive-keyring</code></pre><h3>2.导入官方 GPG 密钥（复制整块命令粘贴）</h3><pre><code>curl https://nginx.org/keys/nginx_signing.key | gpg --dearmor \
| sudo tee /usr/share/keyrings/nginx-archive-keyring.gpg &gt;/dev/null</code></pre><h3>3.验证下载的文件是否包含正确的密钥</h3><pre><code>gpg --dry-run --quiet --no-keyring --import --import-options import-show /usr/share/keyrings/nginx-archive-keyring.gpg</code></pre><h4>输出应包含完整指纹，如下所示：</h4><pre><code>pub   rsa2048 2011-08-19 [SC] [expires: 2024-06-14]
      573BFD6B3D8FBC641079A6ABABF5BD827BD9BF62
uid                      nginx signing key &lt;signing-key@nginx.com&gt;</code></pre><h3>4.添加 nginx 官方仓库到 apt 软件源</h3><p>nginx 仓库分为 Mainline version（主线版）和 Stable version（稳定版）；<br>Mainline version：可以理解为测试版，会持续修复 Bug 并包含最新的特性，因为持续的加入特性可能会导致新的 Bug。如果想体验最新的功能，例如 HTTP/3 实验性支持，建议使用该版本。<br>Stable version：修复了关键性的 Bug，比较稳定，但是功能特性可能不是最新的，推荐用于生产环境。</p><p>以下两个添加仓库的命令按需求选择其中之一就行了~</p><p>添加 Mainline version（主线版）仓库</p><pre><code>echo &quot;deb [signed-by=/usr/share/keyrings/nginx-archive-keyring.gpg] \
http://nginx.org/packages/mainline/debian `lsb_release -cs` nginx&quot; \
    | sudo tee /etc/apt/sources.list.d/nginx.list</code></pre><p>添加 Stable version（稳定版）仓库</p><pre><code>echo &quot;deb [signed-by=/usr/share/keyrings/nginx-archive-keyring.gpg] \
http://nginx.org/packages/debian `lsb_release -cs` nginx&quot; \
    | sudo tee /etc/apt/sources.list.d/nginx.list</code></pre><h3>5.设置存储库固定优先选择 nginx 官方仓库分发提供的包</h3><pre><code>echo -e &quot;Package: *\nPin: origin nginx.org\nPin: release o=nginx\nPin-Priority: 900\n&quot; \
    | sudo tee /etc/apt/preferences.d/99nginx</code></pre><h3>6.更新软件源</h3><pre><code>apt update</code></pre><h3>7.安装 nginx</h3><pre><code>apt install nginx -y</code></pre><h3>8.运行nginx</h3><pre><code>systemctl start nginx</code></pre><h3>9.查看 nginx 运行状态</h3><pre><code>systemctl status nginx</code></pre><p>输出内容：</p><pre><code>● nginx.service - nginx - high performance web server
     Loaded: loaded (/lib/systemd/system/nginx.service; enabled; preset: enabled)
     Active: active (running) since Sun 2023-10-22 04:24:44 CST; 17h ago
       Docs: https://nginx.org/en/docs/
    Process: 37688 ExecStart=/usr/sbin/nginx -c /etc/nginx/nginx.conf (code=exited,&gt;    Process: 38070 ExecReload=/bin/sh -c /bin/kill -s HUP $(/bin/cat /var/run/nginx&gt;   Main PID: 37689 (nginx)
      Tasks: 3 (limit: 1110)
     Memory: 229.6M
        CPU: 8.955s
     CGroup: /system.slice/nginx.service
             ├─37689 &quot;nginx: master process /usr/sbin/nginx -c /etc/nginx/nginx.con&gt;
             ├─38077 &quot;nginx: worker process&quot;
             └─38078 &quot;nginx: worker process&quot;</code></pre><h3>10.按 q 键取消查看运行状态</h3><h3>11.通过浏览器访问主机，正常情况下应该会出现 nginx 欢迎页面</h3><h3>12.nginx默认配置</h3><p>默认配置文件：<code>/etc/nginx/conf.d/default.conf</code><br>默认HTML页面：<code>/usr/share/nginx/html</code></p><h2>三、nginx 初始化配置</h2><h3>1.创建文件夹用于存放虚拟主机配置文件</h3><pre><code>mkdir -p /etc/nginx/sites-available</code></pre><h3>2.创建文件夹用于存放虚拟主机配置文件的软连接</h3><pre><code>mkdir -p /etc/nginx/sites-enabled</code></pre><h3>3.创建文件夹用于存放网站文件</h3><pre><code>mkdir -p /www/wwwroot</code></pre><h3>4.创建文件夹用于存放网站证书</h3><pre><code>mkdir -p /www/cert</code></pre><h3>5.创建文件夹用于存放网站日志</h3><pre><code>mkdir -p /www/wwwlogs</code></pre><h3>6.备份 nginx主配置文件</h3><pre><code>mv /etc/nginx/nginx.conf /etc/nginx/nginx.conf.bak</code></pre><h3>7.新建 nginx主配置文件</h3><pre><code>nano /etc/nginx/nginx.conf</code></pre><p>插入以下代码：</p><pre><code># 定义 nginx 运行用户
user www-data;
# pid 文件路径
pid /var/run/nginx.pid;
# 运行进程数（建议设置为等于 CPU 线程数）
worker_processes 2;
# 最大打开文件数
worker_rlimit_nofile 65535;

# 加载启用的模块
include /etc/nginx/modules-enabled/*.conf;

events {
    # Nginx 事件处理模型
    use epoll;
    # 同时接收多个新连接
    multi_accept on;
    # 单个进程允许的客户端最大连接数
    worker_connections 65535;
}

http {
    # 默认编码
    charset utf-8;
    # 开启文件的高效传输模式
    sendfile on;
    # 激活 TCP_CORK socket（阻塞住此头部数据，与之后的 sendfile 数据一同发送，优化吞吐性能）
    tcp_nopush on;
    # 小的数据包不等待直接传输
    tcp_nodelay on;
    # 保持链接超时设定（实现服务器与客户端之间的长连接，减少系统对TCP连接的建立和销毁的开销）
    keepalive_timeout 65;
    # 隐藏 Nginx 版本号
    server_tokens off;
    # 设定文件不存在的错误是否写入日志
    log_not_found off;
    # 哈希的最大值，影响散列表的冲突率，值越大消耗内存越多，但散列 key 的冲突率会降低。
    types_hash_max_size 2048;
    # 设置每个散列桶占用的内存大小
    types_hash_bucket_size 64;
    # 限制上传文件的大小
    client_max_body_size 256M;

    # MIME 媒体类型配置
    include mime.types;
    default_type application/octet-stream;

    # 日志配置
    # 全局访问日志文件
    access_log /var/log/nginx/access.log;
    # 全局错误日志文件和记录级别设定
    error_log /var/log/nginx/error.log warn;

    # 加载其他配置文件
    include /etc/nginx/conf.d/*.conf;

    # 加载启用的站点配置文件
    include /etc/nginx/sites-enabled/*;
}</code></pre><p><a href="https://xmix.one/usr/uploads/2025/06/2823130161.zip">nginx.zip</a></p><h3>8.测试 nginx 配置文件</h3><pre><code>nginx -t</code></pre><p>输出内容：</p><pre><code>nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful</code></pre><h3>9.重新启动 nginx</h3><pre><code>systemctl restart nginx</code></pre><h3>10.查看 nginx 运行状态</h3><pre><code>systemctl status nginx</code></pre><h3>11.按 q 键退出运行状态查看</h3><h3>12.nginx 的安装至此已经完成，如果需要新建站点，可以按以下步骤操作</h3><h4>（1）在 /etc/nginx/sites-available 目录创建配置文件</h4><p>示例命令：<code>nano /etc/nginx/sites-available/test.conf</code></p><h4>（2）在 /etc/nginx/sites-enabled 目录创建配置文件的软链接以启用站点</h4><p>示例命令：<code>ln -s /etc/nginx/sites-available/test.conf /etc/nginx/sites-enabled/test.conf</code></p><h4>（3）测试配置文件</h4><pre><code>nginx -t</code></pre><h4>（4）重新加载 nginx</h4><pre><code>systemctl reload nginx</code></pre><h4>（5）关于 Gzip 功能</h4><p>不建议在 http {} 内直接添加 Gzip 的配置，如果在 http {} 内直接添加会应用到全部站点，部分站点可能并不需要开启 Gzip 压缩，正确的做法是在 Server {} 内添加 Gzip 的功能代码对单站点启用。代码如下：</p><pre><code>    # gzip 功能开关
    gzip on;
    # 启用应答头&quot;Vary: Accept-Encoding&quot;（声明数据经过了压缩处理）
    gzip_vary on;
    # 设定触发压缩的条件为无条件（做为反向代理的时候启用）
    gzip_proxied any;
    # gzip 压缩级别
    gzip_comp_level 6;
    # 设置需要压缩的MIME类型
    gzip_types text/plain text/css text/xml application/json application/javascript application/rss+xml application/atom+xml image/svg+xml;</code></pre><h2>四、安装并初始化 MariaDB 数据库</h2><h3>1.安装 MariaDB</h3><p>Debian 11 默认存储库的 MariaDB 版本是 10.5</p><pre><code>apt install -y mariadb-server</code></pre><h3>2.运行安全设置向导</h3><pre><code>mysql_secure_installation</code></pre><h3>3.安全设置向导中各个询问的选择</h3><pre><code>Enter current password for root (enter for none):
输入 mysql 的 root 密码，默认没有，回车确认。

Switch to unix_socket authentication [Y/n]
切换到 unix 套接字身份验证？选择：否

Change the root password? [Y/n]
设置 root 密码？选择：是（自行设置密码）

Remove anonymous users? [Y/n]
删除匿名（空用户）用户？选择：是

Disallow root login remotely? [Y/n]
不允许远程root登录？选择：否

Remove test database and access to it? [Y/n]
删除 test 数据库？选择：是

Reload privilege tables now? [Y/n]
是否重新加载权限表使之生效？选择：是</code></pre><h2>五、安装 PHP 及相关扩展模块</h2><h3>PHP8.2篇</h3><h4>1.导入 Ondřej Surý PHP 仓库的 GPG 签名密钥并添加软件源</h4><pre><code>sudo apt install -y lsb-release ca-certificates apt-transport-https
echo &quot;deb https://packages.sury.org/php/ $(lsb_release -sc) main&quot; | sudo tee /etc/apt/sources.list.d/php.list</code></pre><h4>2.更新系统的存储库索引并执行软件包更新</h4><pre><code>wget -qO - https://packages.sury.org/php/apt.gpg | sudo apt-key add -
sudo apt update</code></pre><h4>3.安装 PHP 8.2 及常用扩展模块</h4><pre><code>apt install -y php8.2-{fpm,cli,common,mysql,curl,dom,exif,fileinfo,imagick,gd,mbstring,xml,zip,memcached,opcache,bcmath,intl,sqlite3}</code></pre><p>Debian 安装 PHP 会自动安装 Apache，但这里准备使用 nginx，所以需要安装 php-fpm ，这样就可以声明 PHP 将以 FPM 的方式运行，就不会安装 Apache 了。</p><h4>4.添加防止跨目录攻击配置</h4><pre><code>sed -i &#039;s/;cgi.fix_pathinfo=1/cgi.fix_pathinfo=0/&#039; /etc/php/8.2/fpm/php.ini</code></pre><p>这条实际上是编辑 /etc/php/8.2/fpm/php.ini 文件，将 ;cgi.fix_pathinfo=1 内容替换为 cgi.fix_pathinfo=0</p><h4>5.设置上传大小限制</h4><pre><code>sed -i &#039;s/upload_max_filesize = 2M/upload_max_filesize = 512M/&#039; /etc/php/8.2/fpm/php.ini
sed -i &#039;s/post_max_size = 8M/post_max_size = 512M/&#039; /etc/php/8.2/fpm/php.ini</code></pre><h4>7.重启 PHP并设置开机启动</h4><pre><code>systemctl restart php8.2-fpm
systemctl enable php8.2-fpm</code></pre><h3>PHP7.4篇</h3><h4>1.导入 Ondřej Surý PHP 仓库的 GPG 签名密钥并添加软件源</h4><pre><code>curl -sSL https://packages.sury.org/php/README.txt | sudo bash -x</code></pre><h4>2.更新系统的存储库索引并执行软件包更新</h4><pre><code>apt update
apt dist-upgrade -y</code></pre><h4>3.安装 PHP 7.4 及常用扩展模块</h4><pre><code>apt install -y php7.4-{fpm,cli,common,mysql,curl,dom,exif,fileinfo,imagick,gd,mbstring,xml,zip,memcached,opcache,bcmath,iconv,intl,simplexml,sqlite3,xmlreader}</code></pre><p>Debian 安装 PHP 会自动安装 Apache，但这里准备使用 nginx，所以需要安装 php-fpm ，这样就可以声明 PHP 将以 FPM 的方式运行，就不会安装 Apache 了。</p><h4>4.添加防止跨目录攻击配置</h4><pre><code>sed -i &#039;s/;cgi.fix_pathinfo=1/cgi.fix_pathinfo=0/&#039; /etc/php/7.4/fpm/php.ini</code></pre><p>这条实际上是编辑 /etc/php/7.4/fpm/php.ini 文件，将 ;cgi.fix_pathinfo=1 内容替换为 cgi.fix_pathinfo=0</p><h4>5.设置上传大小限制</h4><pre><code>sed -i &#039;s/upload_max_filesize = 2M/upload_max_filesize = 256M/&#039; /etc/php/7.4/fpm/php.ini
sed -i &#039;s/post_max_size = 8M/post_max_size = 256M/&#039; /etc/php/7.4/fpm/php.ini</code></pre><h4>6.重启 PHP并设置开机启动</h4><pre><code>systemctl restart php7.4-fpm
systemctl enable php7.4-fpm</code></pre><h3>PHP测试</h3><h4>1.创建目录用于存放测试PHP的页面</h4><pre><code>mkdir -p /www/wwwroot/php-test</code></pre><h4>2.新建 Vhost 配置文件，用于测试 PHP</h4><pre><code>nano /etc/nginx/conf.d/php-test.conf</code></pre><p>写入代码：</p><pre><code>server {
    # 监听IPv4的80端口
    listen 80;
    # 绑定域名或IP
    server_name 192.168.1.123;
    # 网站根目录
    root /www/wwwroot/php-test;
    # 默认文档
    index index.php index.html index.htm;

    # 开启 PHP7.4-fpm 模式
    location ~ \.php$ {
        fastcgi_pass unix:/run/php/php7.4-fpm.sock;
                # fastcgi_pass unix:/run/php/php8.2-fpm.sock;
        fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
        include fastcgi_params;
    }
}</code></pre><h4>3.测试 nginx 配置文件</h4><pre><code>nginx -t</code></pre><h4>4.重新加载 nginx</h4><pre><code>systemctl reload nginx</code></pre><h4>5.创建 php 测试文件</h4><pre><code>nano /www/wwwroot/php-test/phpinfo.php</code></pre><p>写入代码：</p><pre><code>&lt;?php 
    phpinfo( ); 
?&gt;</code></pre><h4>6.在浏览器打开以下地址，如果看到经典的 phpinfo 页面则说明安装成功</h4><p><code>http://ip/phpinfo.php</code></p><h4>7.测试成功后，按顺序执行以下命令，删除测试站点及相关文件。</h4><h5>（1）删除测试站点 nginx 配置文件</h5><pre><code>rm /etc/nginx/conf.d/php-test.conf</code></pre><h5>（2）删除测试站点工作目录</h5><pre><code>rm -r /www/wwwroot/php-test</code></pre><h5>（3）重新加载 nginx</h5><pre><code>systemctl reload nginx</code></pre><h2>六、安装FFmpeg</h2><p>如果需要使用files.gallery的视频缩略图功能，需要安装ffmpeg</p><pre><code>sudo apt install ffmpeg</code></pre><p>然后运行</p><pre><code>type -P ffmpeg</code></pre><p>得到ffmpeg的运行目录，填写在files.gallery的相应处，同时需要<code>&#039;image_resize_cache&#039; =&gt; true</code></p><h2>七、MariaDB 数据库服务器性能优化（可选）</h2><h3>1.编辑配置文件</h3><pre><code>nano /etc/mysql/mariadb.conf.d/50-server.cnf</code></pre><h3>2.根据需求在文件中修改/添加的各项配置</h3><p>nano 可以使用 Ctrl+W 组合键搜索内容</p><pre><code>【512MB 内存方案】
key_buffer_size = 32M
query_cache_size = 4M
tmp_table_size = 4M
innodb_buffer_pool_size = 8M
innodb_log_buffer_size = 4M
sort_buffer_size = 128K
read_buffer_size = 64K
read_rnd_buffer_size = 128K
join_buffer_size = 128K
thread_stack = 128K
thread_cache_size = 16
binlog_cache_size = 128K
table_open_cache = 32
max_connections = 384

【1GB 内存方案】
key_buffer_size = 64M
query_cache_size = 8M
tmp_table_size = 8M
innodb_buffer_pool_size = 16M
innodb_log_buffer_size = 8M
sort_buffer_size = 256K
read_buffer_size = 128K
read_rnd_buffer_size = 256K
join_buffer_size = 256K
thread_stack = 256K
thread_cache_size = 32
binlog_cache_size = 256K
table_open_cache = 64
max_connections = 512

【2GB 内存方案】
key_buffer_size = 128M
query_cache_size = 16M
tmp_table_size = 16M
innodb_buffer_pool_size = 32M
innodb_log_buffer_size = 16M
sort_buffer_size = 512K
read_buffer_size = 256K
read_rnd_buffer_size = 512K
join_buffer_size = 512K
thread_stack = 512K
thread_cache_size = 64
binlog_cache_size = 512K
table_open_cache = 128
max_connections = 512

【4GB 内存方案】
key_buffer_size = 256M
query_cache_size = 32M
tmp_table_size = 32M
innodb_buffer_pool_size = 64M
innodb_log_buffer_size = 32M
sort_buffer_size = 1024K
read_buffer_size = 512K
read_rnd_buffer_size = 1024K
join_buffer_size = 1024K
thread_stack = 1024K
thread_cache_size = 128
binlog_cache_size = 1024K
table_open_cache = 256
max_connections = 512</code></pre><h3>3.重启 MariaDB 数据库服务器</h3><pre><code>systemctl restart mariadb.service</code></pre><h3>4.进入 MariaDB 数据库控制命令行</h3><pre><code>mariadb</code></pre><h3>5.执行语句验证配置（输出结果以字节为单位）</h3><pre><code>show variables like &#039;key_buffer_size&#039;;
show variables like &#039;query_cache_size&#039;;
show variables like &#039;tmp_table_size&#039;;
show variables like &#039;innodb_buffer_pool_size&#039;;
show variables like &#039;innodb_log_buffer_size&#039;;
show variables like &#039;sort_buffer_size&#039;;
show variables like &#039;read_buffer_size&#039;;
show variables like &#039;read_rnd_buffer_size&#039;;
show variables like &#039;join_buffer_size&#039;;
show variables like &#039;thread_stack&#039;;
show variables like &#039;thread_cache_size&#039;;
show variables like &#039;binlog_cache_size&#039;;
show variables like &#039;table_open_cache&#039;;
show variables like &#039;max_connections&#039;;</code></pre><h3>6.退出 MariaDB 数据库控制命令行</h3><pre><code>exit</code></pre><h2>八、设置 PHP-FPM 的进程池为动态模式（可选）</h2><h3>1.编辑 PHP-FPM 配置文件</h3><pre><code>nano /etc/php/7.4/fpm/pool.d/www.conf</code></pre><h3>2.修改运行模式为动态模式，并按需修改相关参数。</h3><p>（1）搜索 <code>pm =</code> 修改参数值为：<code>dynamic</code></p><pre><code>pm = dynamic</code></pre><p>（2）搜索<code> pm.max_children =</code> 修改参数值为：<code>32</code></p><pre><code>pm.max_children = 32</code></pre><p>作用：控制静态方式下开启的PHP-FPM进程数量</p><p>（3）搜索 <code>pm.start_servers =</code> 修改参数值为：<code>16</code></p><pre><code>pm.start_servers = 16</code></pre><p>作用：控制动态方式下的起始PHP-FPM进程数量</p><p>（4）搜索<code> pm.min_spare_servers = </code>修改参数值为：<code>16</code></p><pre><code>pm.min_spare_servers = 16</code></pre><p>作用：控制动态方式下的最小PHP-FPM进程数量</p><p>（5）搜索 <code>pm.max_spare_servers =</code> 修改参数值为：<code>32</code></p><pre><code>pm.max_spare_servers = 32</code></pre><p>作用：控制动态方式下的最大PHP-FPM进程数量</p><h3>3.重启 PHP</h3><pre><code>systemctl restart php7.4-fpm</code></pre><h2>九、安装 Memcached 服务端（可选）</h2><p>Memcached 是高性能内存键值数据存储器，可以为 WordPress 提供缓存功能。</p><h3>1.安装 Memcached 和必须的 CLI 命令行工具</h3><pre><code>apt install -y memcached libmemcached-tools</code></pre><h3>2.修改分配给 Memcached 的内存</h3><pre><code>sed -i &#039;s/-m 64/-m 256/&#039; /etc/memcached.conf</code></pre><p>这条命令的作用是编辑 /etc/memcached.conf 文件，将 -m 64 内容替换为 -m 256。</p><h3>3.重启 Memcached</h3><pre><code>systemctl restart memcached</code></pre><h3>4.查看 Memcached 运行状态</h3><pre><code>systemctl status memcached</code></pre><h3>5.按 q 键退出运行状态查看</h3><h2>十、修改 PHP Session 的存储引擎为 Memcached（可选）</h2><h3>1.编辑 PHP 配置文件</h3><pre><code>nano /etc/php/7.4/fpm/php.ini</code></pre><p>2.修改 Session 的存储引擎为 Memcached<br>（1）搜索<code> session.save_handler</code> ，修改参数值为：<code>memcached</code></p><pre><code>session.save_handler = memcached</code></pre><p>（2）在下一行添加 <code>session.save_path</code> 的配置，参数值为 memcached 监听端口</p><pre><code>session.save_path = &quot;127.0.0.1:11211&quot;</code></pre><p>3.重启 PHP</p><pre><code>systemctl restart php7.4-fpm</code></pre><p>至此，LEMP 环境已经完成安装~</p>
]]></content:encoded>
<slash:comments>0</slash:comments>
<comments>https://xmix.one/archives/73/#comments</comments>
<wfw:commentRss>https://xmix.one/feed/archives/73/</wfw:commentRss>
</item>
<item>
<title>Docker 相关命令</title>
<link>https://xmix.one/archives/45/</link>
<guid>https://xmix.one/archives/45/</guid>
<pubDate>Sun, 22 May 2022 13:26:00 +0000</pubDate>
<dc:creator>冷清寒</dc:creator>
<category><![CDATA[默认分类]]></category>
<description><![CDATA[一、Docker安装CentOS 7、Debian、Ubuntucurl -sSL https://get.docker.com/ | sh官方文档提供了脚本安装的途径wget --no-che...]]></description>
<content:encoded xml:lang="zh-CN"><![CDATA[
<h2>一、Docker安装</h2><p>CentOS 7、Debian、Ubuntu</p><pre><code>curl -sSL https://get.docker.com/ | sh</code></pre><h3>官方文档提供了脚本安装的途径</h3><pre><code class="lang-shell">wget --no-check-certificate https://get.docker.com/ -O - | bash</code></pre><p>输入 docker -v 查看版本信息</p><h3>开机启动</h3><pre><code class="lang-shell">systemctl start docker
systemctl enable docker</code></pre><h3>Docker更新</h3><pre><code class="lang-shell">sudo apt update</code></pre><h2>二、安装 docker-compose</h2><h3>国外机：</h3><pre><code>sudo curl -L &quot;https://github.com/docker/compose/releases/download/v2.18.1/docker-compose-$(uname -s)-$(uname -m)&quot; -o /usr/local/bin/docker-compose</code></pre><pre><code>sudo chmod +x /usr/local/bin/docker-compose</code></pre><h3>国内机</h3><pre><code>curl -L https://get.daocloud.io/docker/compose/releases/download/v2.18.1/docker-compose-`uname -s`-uname -m &gt; /usr/local/bin/docker-compose</code></pre><h3>重要的步骤</h3><pre><code>chmod +x /usr/local/bin/docker-compose</code></pre><h3>使用docker-compose</h3><p>找到DOCKER项目的文件<br>•上传 docker-compose.yml 文件<br>运行</p><pre><code>docker compose up -d</code></pre><h3>更新docker-compose</h3><pre><code>docker compose pull &amp;&amp; docker compose down &amp;&amp; docker compose up -d &amp;&amp; docker image prune -f</code></pre><h2>三、查看docker日志</h2><pre><code>docker logs -f name</code></pre><h3>设置 Docker 容器日志大小</h3><h4>1.新建<code>/etc/docker/daemon.json</code>，若有就不用新建了。添加log-dirver和log-opts参数，样例如下：</h4><pre><code># vim /etc/docker/daemon.json

{
  &quot;log-driver&quot;:&quot;json-file&quot;,
  &quot;log-opts&quot;: {&quot;max-size&quot;:&quot;500m&quot;, &quot;max-file&quot;:&quot;3&quot;}
}</code></pre><p>max-size=500m，意味着一个容器日志大小上限是500M， <br>max-file=3，意味着一个容器有三个日志，分别是id+.json、id+1.json、id+2.json。</p><h4>2.然后重启docker的守护线程</h4><p>命令如下：</p><pre><code>systemctl daemon-reload
systemctl restart docker</code></pre><p>【需要注意的是：设置的日志大小规则，只对新建的容器有效】</p><h2>四、修改docker容器内容</h2><p>一般用这个:<br><code>docker exec -it 容器ID /bin/bash</code></p><p><code>docker exec -it 180144ea21cd /bin/bash</code></p><p>但是很多docker封装的很鸡贼,得用这个:</p><p><code>docker exec -it 180144ea21cd /bin/sh</code></p><p>还有些更鸡贼,不给权限,禁区不是root,就用这个:<br><code>docker exec -u 0 -it 180144ea21cd /bin/sh</code></p><p><code>exit</code><br>退出docker编辑</p><h2>五、Docker 清理垃圾</h2><h3>1 查看磁盘空间占用情况</h3><pre><code>df -h</code></pre><h3>查看 Docker 容器、镜像、卷等资源的占用情况</h3><pre><code>docker system df</code></pre><h3>清理指定镜像</h3><pre><code>docker images</code></pre><pre><code>docker rmi 5457fb6ac112 01bbee84cc9c 4d81f08e4937</code></pre><h3>清理所有废弃镜像与Build Cache</h3><pre><code>docker system prune -a</code></pre><h3>多种 prune 命令来清理垃圾</h3><pre><code>docker image prune # 清理镜像
docker container prune # 清理容器
docker volume prune # 清理卷
docker builder prune # 清理构建缓存</code></pre><h2>六、删除镜像</h2><p>1.查询运行容器</p><pre><code>docker ps -a</code></pre><p>2.停止容器</p><pre><code>docker stop id
</code></pre><p>3.查询停止容器</p><pre><code>docker ps -n 5</code></pre><p>4.启动容器</p><pre><code>docker start numid</code></pre><p>5.删除容器</p><pre><code>docker rm id
</code></pre><p>6.查询镜像</p><pre><code>docker images
</code></pre><p>7.删除镜像</p><pre><code>docker rmi id</code></pre><h2>七、卸载清除 Docker</h2><p>dpkg<img src="https://xmix.one/usr/uploads/2023/01/3785604026.png" alt="46" title="46"></p><pre><code class="lang-shell">dpkg -l | grep docker</code></pre><p>　　通过dpkg列出docker相关的软件包<br>卸载</p><pre><code class="lang-shell">apt-get remove docker-ce-cli docker-ce
apt-get autoremove # 会自动卸载containerd.io等一干软件。</code></pre>
]]></content:encoded>
<slash:comments>0</slash:comments>
<comments>https://xmix.one/archives/45/#comments</comments>
<wfw:commentRss>https://xmix.one/feed/archives/45/</wfw:commentRss>
</item>
<item>
<title>VPS常用脚本汇编</title>
<link>https://xmix.one/archives/88/</link>
<guid>https://xmix.one/archives/88/</guid>
<pubDate>Thu, 31 Oct 2024 08:29:00 +0000</pubDate>
<dc:creator>冷清寒</dc:creator>
<category><![CDATA[默认分类]]></category>
<description><![CDATA[集成脚本nodequalitybash &lt;(curl -sL https://run.NodeQuality.com)bash &lt;(curl -sL https://sh.nodes...]]></description>
<content:encoded xml:lang="zh-CN"><![CDATA[
<h2>集成脚本</h2><p>nodequality</p><pre><code>bash &lt;(curl -sL https://run.NodeQuality.com)</code></pre><pre><code>bash &lt;(curl -sL https://sh.nodeseek.com)</code></pre><h2>1、DD重装脚本</h2><p>史上最强脚本</p><pre><code>wget --no-check-certificate -qO InstallNET.sh &#039;https://raw.githubusercontent.com/leitbogioro/Tools/master/Linux_reinstall/InstallNET.sh&#039; &amp;&amp; chmod a+x InstallNET.sh &amp;&amp; bash InstallNET.sh -debian 12 -pwd &#039;password&#039;</code></pre><p>萌咖大佬的脚本</p><pre><code>bash &lt;(wget --no-check-certificate -qO- &#039;https://raw.githubusercontent.com/MoeClub/Note/master/InstallNET.sh&#039;) -d 11 -v 64 -p 密码 -port 端口 -a -firmware</code></pre><p>beta.gs大佬的脚本</p><pre><code>wget --no-check-certificate -O NewReinstall.sh https://raw.githubusercontent.com/fcurrk/reinstall/master/NewReinstall.sh &amp;&amp; chmod a+x NewReinstall.sh &amp;&amp; bash NewReinstall.sh</code></pre><p>DD windows（使用史上最强DD脚本）</p><pre><code>bash &lt;(curl -sSL https://raw.githubusercontent.com/leitbogioro/Tools/master/Linux_reinstall/InstallNET.sh) -windows 10  -lang &quot;cn&quot;</code></pre><pre><code>账户：Administrator
密码：Teddysun.com</code></pre><p>使用Windows徽标+R快捷键打开运行框，输入powershell运行，弹出powershell命名输入窗口，输入以下命令：irm <a href="https://get.activated.win">https://get.activated.win</a> | iex</p><h2>2、综合测试脚本</h2><p>bench.sh</p><pre><code>wget -qO- bench.sh | bash</code></pre><p>LemonBench</p><pre><code>wget -qO- https://raw.githubusercontent.com/LemonBench/LemonBench/main/LemonBench.sh | bash -s -- --fast</code></pre><p>融合怪</p><pre><code>bash &lt;(wget -qO- --no-check-certificate https://gitlab.com/spiritysdx/za/-/raw/main/ecs.sh)</code></pre><p>NodeBench</p><pre><code>bash &lt;(curl -sL https://raw.githubusercontent.com/LloydAsp/NodeBench/main/NodeBench.sh)</code></pre><p>网络质量体检脚本(<a href="https://github.com/xykt/NetQuality">https://github.com/xykt/NetQuality</a>)</p><pre><code>bash &lt;(curl -Ls Net.Check.Place)</code></pre><h2>3、性能测试</h2><p>yabs</p><pre><code>curl -sL yabs.sh | bash</code></pre><p>跳过网络，测GB5</p><pre><code>curl -sL yabs.sh | bash -s -- -i5</code></pre><p>跳过网络和磁盘，测GB5</p><pre><code>curl -sL yabs.sh | bash -s -- -if5</code></pre><p>改测GB5不测GB6</p><pre><code>curl -sL yabs.sh | bash -s -- -5</code></pre><p>检查是否超售</p><pre><code>lsmod | grep virtio_balloon</code></pre><h2>4、流媒体及IP质量测试</h2><p>最常用版本</p><pre><code>bash &lt;(curl -L -s check.unlock.media)</code></pre><p>原生检测脚本</p><pre><code>bash &lt;(curl -sL Media.Check.Place)</code></pre><p>准确度最高</p><pre><code>bash &lt;(curl -L -s https://github.com/1-stream/RegionRestrictionCheck/raw/main/check.sh)</code></pre><p>IP质量体检脚本</p><pre><code>bash &lt;(curl -sL IP.Check.Place)</code></pre><p>一键修改解锁DNS</p><pre><code>wget https://raw.githubusercontent.com/Jimmyzxk/DNS-Alice-Unlock/refs/heads/main/dns-unlock.sh &amp;&amp; bash dns-unlock.sh</code></pre><h2>5、测速脚本</h2><p>Speedtest</p><pre><code>bash &lt;(curl -sL bash.icu/speedtest)</code></pre><p>Taier</p><pre><code>bash &lt;(curl -sL res.yserver.ink/taier.sh)</code></pre><p>hyperspeed</p><pre><code>bash &lt;(curl -Lso- https://bench.im/hyperspeed)</code></pre><p>全球测速</p><pre><code>curl -sL network-speed.xyz | bash</code></pre><h2>6、回程测试</h2><pre><code>bash &lt;(curl -Ls Check.Place) -N</code></pre><h2>7、功能脚本</h2><p>添加SWAP</p><pre><code>wget https://www.moerats.com/usr/shell/swap.sh &amp;&amp; bash swap.sh</code></pre><p>Fail2ban</p><pre><code>wget --no-check-certificate https://raw.githubusercontent.com/FunctionClub/Fail2ban/master/fail2ban.sh &amp;&amp; bash fail2ban.sh 2&gt;&amp;1 | tee fail2ban.log</code></pre><p>一键开启BBR，适用于较新的Debian、Ubuntu</p><pre><code>echo &quot;net.core.default_qdisc=fq&quot; &gt;&gt; /etc/sysctl.conf
echo &quot;net.ipv4.tcp_congestion_control=bbr&quot; &gt;&gt; /etc/sysctl.conf
sysctl -p
sysctl net.ipv4.tcp_available_congestion_control
lsmod | grep bbr</code></pre><p>多功能BBR安装脚本</p><pre><code>wget -N --no-check-certificate &quot;https://gist.github.com/zeruns/a0ec603f20d1b86de6a774a8ba27588f/raw/4f9957ae23f5efb2bb7c57a198ae2cffebfb1c56/tcp.sh&quot; &amp;&amp; chmod +x tcp.sh &amp;&amp; ./tcp.sh</code></pre><p>锐速/BBRPLUS/BBR2/BBR3</p><pre><code>wget -O tcpx.sh &quot;https://github.com/ylx2016/Linux-NetSpeed/raw/master/tcpx.sh&quot; &amp;&amp; chmod +x tcpx.sh &amp;&amp; ./tcpx.sh</code></pre><p>TCP窗口调优</p><pre><code>wget http://sh.nekoneko.cloud/tools.sh -O tools.sh &amp;&amp; bash tools.sh</code></pre><p>添加warp</p><pre><code>wget -N https://gitlab.com/fscarmen/warp/-/raw/main/menu.sh &amp;&amp; bash menu.sh [option] [lisence/url/token]</code></pre><p>25端口开放测试</p><pre><code>telnet smtp.aol.com 25</code></pre><h2>8、一键安装常用环境及软件</h2><p>docker</p><pre><code>curl -sSL https://get.daocloud.io/docker | sh</code></pre><p>Python</p><pre><code>curl -O https://raw.githubusercontent.com/lx969788249/lxspacepy/master/pyinstall.sh &amp;&amp; chmod +x pyinstall.sh &amp;&amp; ./pyinstall.sh</code></pre><p>iperf3</p><pre><code>apt install iperf3</code></pre><p>realm</p><pre><code>bash &lt;(curl -L https://raw.githubusercontent.com/zhouh047/realm-oneclick-install/main/realm.sh) -i</code></pre><p>gost</p><pre><code>wget --no-check-certificate -O gost.sh https://raw.githubusercontent.com/qqrrooty/EZgost/main/gost.sh &amp;&amp; chmod +x gost.sh &amp;&amp; ./gost.sh</code></pre><p>极光面板</p><pre><code>bash &lt;(curl -fsSL https://raw.githubusercontent.com/Aurora-Admin-Panel/deploy/main/install.sh)</code></pre><p>哪吒监控</p><pre><code>curl -L https://raw.githubusercontent.com/naiba/nezha/master/script/install.sh  -o nezha.sh &amp;&amp; chmod +x nezha.sh &amp;&amp; sudo ./nezha.sh</code></pre><p>WARP</p><pre><code>wget -N https://gitlab.com/fscarmen/warp/-/raw/main/menu.sh &amp;&amp; bash menu.sh</code></pre><p>Aria2</p><pre><code>wget -N git.io/aria2.sh &amp;&amp; chmod +x aria2.sh &amp;&amp; ./aria2.sh</code></pre><p>宝塔</p><pre><code>wget -O install.sh http://v7.hostcli.com/install/install-ubuntu_6.0.sh &amp;&amp; sudo bash install.sh</code></pre><p>PVE虚拟化</p><pre><code>bash &lt;(wget -qO- --no-check-certificate https://raw.githubusercontent.com/oneclickvirt/pve/main/scripts/build_backend.sh)</code></pre><p>Argox</p><pre><code>bash &lt;(wget -qO- https://raw.githubusercontent.com/fscarmen/argox/main/argox.sh)</code></pre><p>sing-box+订阅(<a href="https://github.com/fscarmen/sing-box">https://github.com/fscarmen/sing-box</a>)</p><pre><code>bash &lt;(wget -qO- https://raw.githubusercontent.com/fscarmen/sing-box/main/sing-box.sh)</code></pre><p>mack-a 8合1 sing-box(<a href="https://github.com/mack-a/v2ray-agent">https://github.com/mack-a/v2ray-agent</a>)</p><pre><code>wget -P /root -N --no-check-certificate &quot;https://raw.githubusercontent.com/mack-a/v2ray-agent/master/install.sh&quot; &amp;&amp; chmod 700 /root/install.sh &amp;&amp; /root/install.sh</code></pre><p>ygkkk sing-box(<a href="https://github.com/yonggekkk/sing-box-yg">https://github.com/yonggekkk/sing-box-yg</a>)</p><pre><code>bash &lt;(curl -Ls https://gitlab.com/rwkgyg/sing-box-yg/raw/main/sb.sh)</code></pre><p>223boy sing-box(<a href="https://233boy.com/sing-box/sing-box-script/">https://233boy.com/sing-box/sing-box-script/</a>）</p><pre><code>bash &lt;(wget -qO- -o- https://github.com/233boy/sing-box/raw/main/install.sh)</code></pre><p>安装3x-ui(<a href="https://github.com/MHSanaei/3x-ui">https://github.com/MHSanaei/3x-ui</a>)</p><pre><code>bash &lt;(curl -Ls https://raw.githubusercontent.com/mhsanaei/3x-ui/master/install.sh)</code></pre><h2>9、综合功能脚本</h2><p>科技lion</p><pre><code>apt update -y  &amp;&amp; apt install -y curl
bash &lt;(curl -sL kejilion.sh)</code></pre><p>SKY-BOX</p><pre><code>wget -O box.sh https://raw.githubusercontent.com/BlueSkyXN/SKY-BOX/main/box.sh &amp;&amp; chmod +x box.sh &amp;&amp; clear &amp;&amp; ./box.sh</code></pre><p>TG中文汉化</p><pre><code>https://t.me/setlanguage/classic-zh-cn</code></pre>
]]></content:encoded>
<slash:comments>0</slash:comments>
<comments>https://xmix.one/archives/88/#comments</comments>
<wfw:commentRss>https://xmix.one/feed/archives/88/</wfw:commentRss>
</item>
<item>
<title>甲骨文重装系统</title>
<link>https://xmix.one/archives/151/</link>
<guid>https://xmix.one/archives/151/</guid>
<pubDate>Sun, 21 Jun 2026 00:48:28 +0000</pubDate>
<dc:creator>冷清寒</dc:creator>
<category><![CDATA[默认分类]]></category>
<description><![CDATA[1、导航至甲骨文实例列表页面，在这里选择你需要重装系统的实例，点击进入到该实例的详情页。2、进入甲骨文实例详情页进行重装系统，这里有两种方式都可以到达重装系统的界面：2.1、在甲骨文实例详情页顶...]]></description>
<content:encoded xml:lang="zh-CN"><![CDATA[
<h3>1、导航至甲骨文实例列表页面，在这里选择你需要重装系统的实例，点击进入到该实例的详情页。</h3><p><img src="https://xmix.one/usr/uploads/2026/06/2323620912.jpg" alt="c4ca4238a0b9238-10-1024x486.jpg" title="c4ca4238a0b9238-10-1024x486.jpg"></p><h3>2、进入甲骨文实例详情页进行重装系统，这里有两种方式都可以到达重装系统的界面：</h3><h4>2.1、在甲骨文实例详情页顶端选项栏，选择【更多操作】-【替换引导卷】</h4><p><img src="https://xmix.one/usr/uploads/2026/06/1969044040.jpg" alt="8fbdbf5573b18fa-1024x486.jpg" title="8fbdbf5573b18fa-1024x486.jpg"></p><h4>2.2、在甲骨文实例详情页下拉到下方列表，选择【引导卷】-【替换引导卷】</h4><p><img src="https://xmix.one/usr/uploads/2026/06/1371026944.jpg" alt="3c46a0407be60a1-1024x486.jpg" title="3c46a0407be60a1-1024x486.jpg"></p><h3>3、点击【替换引导卷】后，在弹出的页面中，选择【映像】、【输入OCID】，并在下方【输入映像OCID】处填入OCID。</h3><p><img src="https://xmix.one/usr/uploads/2026/06/3452138543.jpg" alt="7866cc7fb5a03c0-1024x486.jpg" title="7866cc7fb5a03c0-1024x486.jpg"></p><p>这里需要注意的是：</p><p>保留引导卷：开启这个功能后，将保留当前引导卷，以后随后所需时使用；如果没有这个需求，就不要开启这个功能。<br>映像OCID：可以通过甲骨文实例详情页下方列表，点击【引导卷】中对应的【映像】后，就能查看到OCID，复制后粘贴到上方即可。<br><img src="https://xmix.one/usr/uploads/2026/06/1772449602.jpg" alt="c9e6e7b69f98f51-1024x486.jpg" title="c9e6e7b69f98f51-1024x486.jpg"></p><p><img src="https://xmix.one/usr/uploads/2026/06/367869597.jpg" alt="b772d43b49bb57b-1024x486.jpg" title="b772d43b49bb57b-1024x486.jpg"></p><p>引导卷大小：默认为47G，可以保持默认，后续后需要再进行扩展。当然，也可以根据自己的使用情况进行调整，但确保引导卷总量不要超过200G，超过后免费用户可能无法替换成功，收费用户将可能出现收取引导卷费用的情况。</p><p>如果你还记得之前的秘钥，则直接【保存】即可。如果你忘记了之前的秘钥或是想更换新的秘钥或密码。在【替换引导卷】中点击页面下方的【高级选项】，点击【元数据】,【名称】处输入user_data，【值】处输入新的公钥，或是下面脚本的base64加密值（base64加密方法可网页搜索“在线base64加密”任选一个进行在线加密即可）</p><pre><code>#!/bin/bash
echo root:你的密码 | chpasswd root
sed -i &#039;s/^#\?PermitRootLogin.*/PermitRootLogin yes/g&#039; /etc/ssh/sshd_config
sed -i &#039;s/^#\?PasswordAuthentication.*/PasswordAuthentication yes/g&#039; /etc/ssh/sshd_config
rm -rf /etc/ssh/sshd_config.d/* &amp;&amp; rm -rf /etc/ssh/ssh_config.d/*
/etc/init.d/ssh* restart</code></pre><p><img src="https://xmix.one/usr/uploads/2026/06/3863063945.jpg" alt="b7b2d5a8d1b4d64.jpg" title="b7b2d5a8d1b4d64.jpg"></p><h3>4、在上方的替换引导卷页面填写完毕并点击【保存】后，该实例的引导卷将经历一个 正在分离 – 已分离 – 正在附加 – 已附加 的过程，持续时间大概3-5分钟。</h3><p><img src="https://xmix.one/usr/uploads/2026/06/58110207.jpg" alt="a87ff679a2f3e71-8-1024x159.jpg" title="a87ff679a2f3e71-8-1024x159.jpg"></p><p><img src="https://xmix.one/usr/uploads/2026/06/3279531011.jpg" alt="1ce3be5d014081b-1024x173.jpg" title="1ce3be5d014081b-1024x173.jpg"></p><p><img src="https://xmix.one/usr/uploads/2026/06/907864544.jpg" alt="4864dafb55d05d7-1024x157.jpg" title="4864dafb55d05d7-1024x157.jpg"></p><p><img src="https://xmix.one/usr/uploads/2026/06/2296607974.jpg" alt="6b5dfcf1f44c9d4-1024x161.jpg" title="6b5dfcf1f44c9d4-1024x161.jpg"></p><p>至此，通过替换引导卷就完成了甲骨文云重装系统的操作。</p><p>最后，如果你前面选择了【保留引导卷】，之后想替换回之前的引导卷时，只需在【替换引导卷】页面，选择【引导卷】、【从列表中选择】，然后在下方列表里选择之前的引导卷后，点击【保存】即可。<br><img src="https://xmix.one/usr/uploads/2026/06/1125563855.jpg" alt="e4da3b7fbbce234-7-1024x486.jpg" title="e4da3b7fbbce234-7-1024x486.jpg"></p><p>文末附上甲骨文云官方支持文档中关于替换引导券的说明：</p><p>更换启动卷<br>您可以自动替换实例的启动卷，而无需终止并重新创建实例。实例停止，替换启动卷，并将实例返回到卷替换过程之前的状态。如果检测到问题或需要升级以实现新功能，此功能允许更换引导卷。</p><p>引导卷替换要求和选项<br>以下是使用启动卷替换的关键操作系统和映像要求：</p><p>仅支持 Linux 操作系统和映像。<br>不支持 Windows 和市场图像。<br>引导卷只能替换为使用相同 Linux 发行版的块卷和映像。例如，您无法从 Oracle Linux 切换到 Ubuntu，反之亦然。<br>映像限制适用于与映像以及实例上当前内容关联的启动选项。例如，如果映像的启动卷附件类型与实例启动选项不匹配，则该映像将被视为无效。</p>
]]></content:encoded>
<slash:comments>0</slash:comments>
<comments>https://xmix.one/archives/151/#comments</comments>
<wfw:commentRss>https://xmix.one/feed/archives/151/</wfw:commentRss>
</item>
<item>
<title>甲骨文Oracle创建预算预警，达到阈值时邮件通知</title>
<link>https://xmix.one/archives/138/</link>
<guid>https://xmix.one/archives/138/</guid>
<pubDate>Tue, 02 Jun 2026 08:08:00 +0000</pubDate>
<dc:creator>冷清寒</dc:creator>
<category><![CDATA[默认分类]]></category>
<description><![CDATA[进入【计费与成本管理 - 预算】点击【创建预算】3.按下图填写4.如达到阈值，会收到如下电子邮件]]></description>
<content:encoded xml:lang="zh-CN"><![CDATA[
<ol><li>进入【计费与成本管理 - 预算】</li><li>点击【创建预算】</li></ol><p>3.按下图填写</p><p><img src="https://xmix.one/usr/uploads/2026/06/1535832739.png" alt="6ee4a93044f186c1d61b8.png" title="6ee4a93044f186c1d61b8.png"></p><p>4.如达到阈值，会收到如下电子邮件</p><p><img src="https://xmix.one/usr/uploads/2026/06/2727178329.png" alt="36648e64f53b2639d4396.png" title="36648e64f53b2639d4396.png"></p>
]]></content:encoded>
<slash:comments>0</slash:comments>
<comments>https://xmix.one/archives/138/#comments</comments>
<wfw:commentRss>https://xmix.one/feed/archives/138/</wfw:commentRss>
</item>
<item>
<title>Debian系统开机一条龙</title>
<link>https://xmix.one/archives/135/</link>
<guid>https://xmix.one/archives/135/</guid>
<pubDate>Tue, 07 Apr 2026 14:08:09 +0000</pubDate>
<dc:creator>冷清寒</dc:creator>
<category><![CDATA[默认分类]]></category>
<description><![CDATA[1、DD系统curl -O https://raw.githubusercontent.com/bin456789/reinstall/main/reinstall.sh &amp;&amp; ...]]></description>
<content:encoded xml:lang="zh-CN"><![CDATA[
<p>1、DD系统</p><pre><code>curl -O https://raw.githubusercontent.com/bin456789/reinstall/main/reinstall.sh &amp;&amp; bash reinstall.sh debian 12 --password 密码 --ssh-port 端口</code></pre><p>2、执行脚本：</p><pre><code>apt update &amp;&amp; apt install -y curl &amp;&amp; bash &lt;(curl -fsSL https://raw.githubusercontent.com/LucaLin233/Linux/refs/heads/main/debian_setup.sh)</code></pre><p>代码审查：<br><a href="https://github.com/LucaLin233/Linux/blob/main/debian_setup.sh">https://github.com/LucaLin233/Linux/blob/main/debian_setup.sh</a></p><p>可选项<br>1、禁用密码登录：</p><pre><code>sudo sed -i &#039;s/^#*PasswordAuthentication yes/PasswordAuthentication no/&#039; /etc/ssh/sshd_config &amp;&amp; sudo systemctl restart sshd</code></pre><p>如果是bin456789 DD的debian系统，请先运行：</p><pre><code>rm -rf /etc/ssh/sshd_config.d/01-permitrootlogin.conf</code></pre><p>2、更换内核：</p><pre><code>curl -fsSL &quot;https://keyserver.ubuntu.com/pks/lookup?op=get&amp;search=0xD38D7D1DA1349567ADED882D86F7D09EE734E623&quot; \
  | sudo gpg --dearmor -o /usr/share/keyrings/xanmod-archive-keyring.gpg</code></pre><pre><code>echo &#039;deb [signed-by=/usr/share/keyrings/xanmod-archive-keyring.gpg] http://deb.xanmod.org releases main&#039; | sudo tee /etc/apt/sources.list.d/xanmod-release.list</code></pre><pre><code>sudo apt update &amp;&amp; sudo apt install -y linux-xanmod-x64v3</code></pre><p>3、开启Swap：</p><pre><code>sudo fallocate -l 1G /swapfile &amp;&amp; sudo chmod 600 /swapfile &amp;&amp; sudo mkswap /swapfile &amp;&amp; sudo swapon /swapfile &amp;&amp; echo &#039;/swapfile none swap sw 0 0&#039; | sudo tee -a /etc/fstab</code></pre><p>移除swap：</p><pre><code>sudo swapoff /swapfile &amp;&amp; sudo sed -i &#039;\#^/swapfile none swap sw 0 0#d&#039; /etc/fstab &amp;&amp; sudo rm /swapfile</code></pre><p>4、内核调优：<br>查看状态:</p><pre><code>curl -fsSL https://raw.githubusercontent.com/LucaLin233/Linux/refs/heads/main/tools/kernel.sh | bash -s status</code></pre><p>恢复配置:</p><pre><code>curl -fsSL https://raw.githubusercontent.com/LucaLin233/Linux/refs/heads/main/tools/kernel.sh | bash -s restore</code></pre><p>优化无国内优化服务时:</p><pre><code>curl -fsSL https://raw.githubusercontent.com/LucaLin233/Linux/refs/heads/main/tools/kernel.sh | bash -s install -i</code></pre><p>优化国内优化服务器时:</p><pre><code>curl -fsSL https://raw.githubusercontent.com/LucaLin233/Linux/refs/heads/main/tools/kernel.sh | bash -s install -c</code></pre><p>交互版:</p><pre><code>curl -fsSL https://raw.githubusercontent.com/LucaLin233/Linux/refs/heads/main/tools/kernel.sh | bash -s install</code></pre><p>5、安装syncthing</p><pre><code>sudo mkdir -p /etc/apt/keyrings &amp;&amp; \
sudo curl -L -o /etc/apt/keyrings/syncthing-archive-keyring.gpg https://syncthing.net/release-key.gpg &amp;&amp; \
echo &quot;deb [signed-by=/etc/apt/keyrings/syncthing-archive-keyring.gpg] https://apt.syncthing.net/ syncthing stable-v2&quot; | sudo tee /etc/apt/sources.list.d/syncthing.list &amp;&amp; \
sudo apt update &amp;&amp; \
sudo apt install syncthing &amp;&amp; \
sudo systemctl enable syncthing@root.service &amp;&amp; \
sudo systemctl start syncthing@root.service</code></pre><p>6、路由追踪（可从一键部署脚本中选择安装）：</p><pre><code>curl -sL nxtrace.org/nt | bash</code></pre><p>7、修改系统dns：</p><pre><code>bash &lt;(curl -L -s https://raw.githubusercontent.com/1-stream/1stream-public-utils/main/dns-change.sh) 127.0.0.1 1.1.1.1</code></pre><p>8、安装Cloudflare Tunnel</p><pre><code>sudo bash -c &quot;$(curl -fsSL https://raw.githubusercontent.com/LucaLin233/Linux/refs/heads/main/tools/cloudflare_tunnel.sh)&quot; -- install</code></pre><p>卸载：</p><pre><code>sudo bash -c &quot;$(curl -fsSL https://raw.githubusercontent.com/LucaLin233/Linux/refs/heads/main/tools/cloudflare_tunnel.sh)&quot; -- uninstall</code></pre><p>9、多功能脚本：</p><pre><code>wget -P /root -N --no-check-certificate &quot;https://raw.githubusercontent.com/jklolixxs/jms/main/jms.sh&quot; &amp;&amp; chmod 700 /root/jms.sh &amp;&amp; /root/jms.sh Bash</code></pre><p>10、流媒体解锁检测：</p><pre><code>bash &lt;(curl -L -s https://github.com/1-stream/RegionRestrictionCheck/raw/main/check.sh)</code></pre><p>11、修改语言为中文：</p><pre><code>apt update &amp;&amp; \
apt install -y locales &amp;&amp; \
sed -i &#039;s/^# *zh_CN.UTF-8 UTF-8/zh_CN.UTF-8 UTF-8/&#039; /etc/locale.gen &amp;&amp; \
locale-gen &amp;&amp; \
update-locale LANG=zh_CN.UTF-8 LANGUAGE=zh_CN:zh LC_ALL=zh_CN.UTF-8</code></pre><p>12、IP质量检测：</p><pre><code>bash &lt;(curl -sL IP.Check.Place)</code></pre>
]]></content:encoded>
<slash:comments>0</slash:comments>
<comments>https://xmix.one/archives/135/#comments</comments>
<wfw:commentRss>https://xmix.one/feed/archives/135/</wfw:commentRss>
</item>
<item>
<title>优秀的CF项目汇总</title>
<link>https://xmix.one/archives/134/</link>
<guid>https://xmix.one/archives/134/</guid>
<pubDate>Thu, 19 Mar 2026 12:47:27 +0000</pubDate>
<dc:creator>冷清寒</dc:creator>
<category><![CDATA[默认分类]]></category>
<description><![CDATA[1、CloudMail https://github.com/maillab/cloud-mail2、NodeWarden https://github.com/shuaiplus/nodewa...]]></description>
<content:encoded xml:lang="zh-CN"><![CDATA[
<p>1、CloudMail <a href="https://github.com/maillab/cloud-mail">https://github.com/maillab/cloud-mail</a></p><p>2、NodeWarden <a href="https://github.com/shuaiplus/nodewarden">https://github.com/shuaiplus/nodewarden</a></p><p>3、CloudFlare图床 <a href="https://github.com/hleov/CloudFlare-ImgBed">https://github.com/hleov/CloudFlare-ImgBed</a></p><p>4、Discord图床 <a href="https://github.com/katelya77/K-Vault">https://github.com/katelya77/K-Vault</a></p><p>5、Antigravity-TG-Big-Bro <a href="https://github.com/sunyuchentrx/Antigravity-TG-Big-Bro">https://github.com/sunyuchentrx/Antigravity-TG-Big-Bro</a></p><p>6、AddressGenerator <a href="https://github.com/jiangnan1224/AddressGenerator">https://github.com/jiangnan1224/AddressGenerator</a></p><p>7、XUGOU <a href="https://github.com/zaunist/xugou">https://github.com/zaunist/xugou</a></p><p>8、cf-drop <a href="https://github.com/lyonbot/cf-drop">https://github.com/lyonbot/cf-drop</a></p><p>9、剩余价值计算器 <a href="https://github.com/realnovicedev/vps_calculator_docker">https://github.com/realnovicedev/vps_calculator_docker</a></p><p>10、另一款剩余价值计算器<a href="https://github.com/verkyer/vps-jsq">https://github.com/verkyer/vps-jsq</a></p><p>11、畅聊 <a href="https://github.com/Shannon-x/chitchatter">https://github.com/Shannon-x/chitchatter</a></p><p>12、CF-M365-Admin <a href="https://github.com/wang4386/CF-M365-Admin">https://github.com/wang4386/CF-M365-Admin</a></p><p>13、NodeCrypt <a href="https://github.com/shuaiplus/NodeCrypt">https://github.com/shuaiplus/NodeCrypt</a></p><p>14、Flare Stack Blog <a href="https://github.com/du2333/flare-stack-blog">https://github.com/du2333/flare-stack-blog</a></p><p>15、CF-Warden <a href="https://github.com/qaz741wsd856/warden-worker">https://github.com/qaz741wsd856/warden-worker</a></p><p>16、OSSshelf <a href="https://github.com/Zoroaaa/OSSshelf">https://github.com/Zoroaaa/OSSshelf</a></p>
]]></content:encoded>
<slash:comments>0</slash:comments>
<comments>https://xmix.one/archives/134/#comments</comments>
<wfw:commentRss>https://xmix.one/feed/archives/134/</wfw:commentRss>
</item>
<item>
<title>CF优选IP</title>
<link>https://xmix.one/archives/132/</link>
<guid>https://xmix.one/archives/132/</guid>
<pubDate>Mon, 23 Feb 2026 11:23:00 +0000</pubDate>
<dc:creator>冷清寒</dc:creator>
<category><![CDATA[默认分类]]></category>
<description><![CDATA[最前面优选IP网站https://ip.v2too.top/https://ip.v2too.top/api/nodeshttps://ipdb.030101.xyz/bestcfv4/http...]]></description>
<content:encoded xml:lang="zh-CN"><![CDATA[
<h2>最前面优选IP网站</h2><p><a href="https://ip.v2too.top/">https://ip.v2too.top/</a><br><a href="https://ip.v2too.top/api/nodes">https://ip.v2too.top/api/nodes</a><br><a href="https://ipdb.030101.xyz/bestcfv4/">https://ipdb.030101.xyz/bestcfv4/</a><br><a href="https://ip.164746.xyz/">https://ip.164746.xyz/</a><br><a href="https://stock.hostmonit.com/CloudFlareYes">https://stock.hostmonit.com/CloudFlareYes</a><br><a href="https://www.cnae.top/">https://www.cnae.top/</a><br><a href="https://saas.sin.fan/">https://saas.sin.fan/</a><br>cf.468123.xyz<br>cf.090227.xyz<br>cf.3666888.xyz<br>cloudflare.182682.xyz<br>cdn.31514926.xyz</p><p><code>备注：这些优选的都是CF的边缘ip，其实还是CF的，不一定是优化的线路</code></p><h2>一、WIN普通版</h2><p>一键测试优选，并且把最快的IP解析到域名</p><h3>1.下载CloudflareSpeedTest</h3><p><code>https://github.com/XIU2/CloudflareSpeedTest</code></p><h3>2.创建脚本</h3><p>解压刚刚GitHub下载的文件，在解压的文件目录创建两个文件run_all.bat跟update_cf_dns.ps1<br><img src="https://xmix.one/usr/uploads/2026/02/2594945672.png" alt="971aca1614f7232d2237f0b91dce00ab.png" title="971aca1614f7232d2237f0b91dce00ab.png"></p><h4>run_all.bat的代码如下</h4><pre><code>@echo off
:: 设置脚本输出的字符集为 UTF-8，以支持中文等字符
chcp 65001

:: 切换到当前批处理脚本所在的目录
cd /d &quot;%~dp0&quot;

:: 输出信息，提示正在删除 result.csv 文件
echo 正在删除 result.csv...
del /f /q &quot;result.csv&quot;

:: 启用延迟变量扩展（用于在同一行中使用变量）
setlocal enabledelayedexpansion

:: ================================
:: 获取当前小时数并判断是否为晚高峰时段
:: ================================
:: 1. 提取当前小时数（取第0到第2位）
set &quot;current_hour=%time:~0,2%&quot;

:: 2. 去除小时数前面的空格（防止 0-9 点时出现 &quot; 8&quot; 导致判断报错）
set &quot;current_hour=%current_hour: =%&quot;

:: 3. 设置晚高峰判断变量（默认设为 false）
set &quot;IS_PEAK=false&quot;

:: 4. 判断逻辑：如果是 20点 到 23点 (20, 21, 22, 23)
if %current_hour% geq 20 if %current_hour% lss 24 (
    set &quot;IS_PEAK=true&quot;
)

:: ================================
:: 根据是否是晚高峰时段，启动不同的 cfst.exe 测速命令
:: ================================
if &quot;%IS_PEAK%&quot;==&quot;true&quot; (
     :: 如果是晚高峰时段，执行更高频率、更高负载的测速任务
     start &quot;&quot; /b &quot;%~dp0cfst.exe&quot; -n 600 -t 8 -dn 10 -dt 15 -tp 443 -url https://speed.cloudflare.com/__down?bytes=200000000 -tl 200 -tll 40 -tlr 1 -p 10 -sl 1 -o &quot;%~dp0result.csv&quot;
) else (
     :: 如果不是晚高峰时段，执行较低频率的测速任务
     start &quot;&quot; /b &quot;%~dp0cfst.exe&quot; -n 600 -t 4 -dn 10 -dt 15 -tp 443 -url https://speed.cloudflare.com/__down?bytes=200000000 -tl 120 -tll 30 -tlr 0.5 -p 10 -sl 2 -o &quot;%~dp0result.csv&quot;
)

:: ================================
:: 启动 PowerShell 脚本（用于更新 Cloudflare DNS）
:: ================================
start powershell -NoProfile -ExecutionPolicy Bypass -File &quot;%~dp0update_cf_dns.ps1&quot;


REM 主窗口自动关闭
</code></pre><h4>update_cf_dns.ps1代码如下，只需要修改配置里面的三个项</h4><pre><code># 循环监听 result.csv 文件
$csvFile = &quot;result.csv&quot;
Write-Host &quot;正在监听 result.csv 文件...&quot;

# 等待 cfst.exe 生成 result.csv 文件
while (-not (Test-Path $csvFile)) {
    Write-Host &quot;等待 result.csv 文件生成...&quot;
    Start-Sleep -Seconds 5
}

Write-Host &quot;检测到 result.csv，等待 10 秒后开始进行 DNS 更新...&quot;

# 等待 10 秒钟后再执行 DNS 更新
Start-Sleep -Seconds 10

Write-Host &quot;开始进行 DNS 更新...&quot;

# 在新的 CMD 窗口中启动 DNS 更新逻辑（例如 Cloudflare API 或任何 DNS 更新方法）
Start-Process cmd.exe -ArgumentList &quot;/K echo 正在开始 DNS 更新... &amp;&amp; REM 在这里添加你的 DNS 更新逻辑 &amp;&amp; pause&quot;

Write-Host &quot;DNS 更新已在新的 CMD 窗口中启动。&quot;


# ---------- 配置 ----------
$CF_API_TOKEN     = &quot;&quot;      # Cloudflare API Token，必须有 Zone.DNS:Edit 权限
$ZONE_ID      = &quot;&quot;           # Cloudflare Zone ID
$DNS_NAME     = &quot;&quot;           # 要更新的域名
$FILE_PATH    = Join-Path $PSScriptRoot &quot;result.csv&quot;
# --------------------------

Write-Host &quot;🚀 脚本开始执行...&quot;

# 读取 CSV 第一行真实 IP 和 下载速度
$csvLine = (Get-Content $FILE_PATH -Encoding UTF8 | Select-Object -Skip 1 | Select-Object -First 1)
$fields = $csvLine.Split(&quot;,&quot;)
$IP = $fields[0].Trim()
$DownloadSpeed = [float]$fields[5].Trim()

# 检查下载速度是否为 0
if ($DownloadSpeed -eq 0) {
    Write-Host &quot;❌ 下载速度为 0，跳过 DNS 更新&quot;
    exit 0
}

Write-Host &quot;📌 获取到 IP: $IP&quot;
Write-Host &quot;📌 下载速度: $DownloadSpeed MB/s&quot;

# 设置请求头
$Headers = @{
    Authorization = &quot;Bearer $CF_API_TOKEN&quot;
    &quot;Content-Type&quot; = &quot;application/json&quot;
}

# 获取 DNS 记录 ID
$Resp = Invoke-RestMethod -Uri &quot;https://api.cloudflare.com/client/v4/zones/$ZONE_ID/dns_records?type=A&amp;name=$DNS_NAME&quot; -Method GET -Headers $Headers
if ($Resp.success -and $Resp.result.Count -gt 0) {
    $DNS_RECORD_ID = $Resp.result[0].id
    Write-Host &quot;📌 DNS记录ID: $DNS_RECORD_ID&quot;
} else {
    Write-Host &quot;❌ 获取 DNS 记录 ID 失败&quot;
    exit 1
}

# 构建 JSON Body（proxied = false，关闭小橙云）
$Body = @{
    type = &quot;A&quot;
    name = $DNS_NAME
    content = $IP
    ttl = 1
    proxied = $false
} | ConvertTo-Json -Compress

# 更新 DNS
$UpdateResp = Invoke-RestMethod -Uri &quot;https://api.cloudflare.com/client/v4/zones/$ZONE_ID/dns_records/$DNS_RECORD_ID&quot; -Method PATCH -Headers $Headers -Body $Body

Write-Host &quot;📌 Cloudflare 返回: $UpdateResp&quot;

if ($UpdateResp.success) {
    Write-Host &quot;✅ DNS记录更新成功: $DNS_NAME -&gt; $IP&quot;
} else {
    Write-Host &quot;❌ DNS更新失败&quot;
}</code></pre><h2>二、WIN优化版</h2><p>优化功能：电脑上测试优选IP，解析最快的IP到cf域名，tg通知结果，上传结果到网页</p><h3>win的脚本代码</h3><pre><code># ========================== 全局参数配置 ==========================
# 程序相关
$cfstPath = &quot;.\cfst.exe&quot;  # cfst.exe 文件路径
$csvFile = &quot;.\result.csv&quot;  # CSV 文件路径

# api相关
$uploadUrl = &quot;https://xxx/api/upload&quot;  # 上传接口 URL
$authKey = &quot;&quot;  # 授权密钥

# 域名更新相关
$zoneId = &quot;&quot;  # Cloudflare Zone ID
$apiToken = &quot;&quot;  # Cloudflare API Token
$recordName = &quot;&quot;  # 要更新的 DNS 记录名称

# 测速相关
$url = &quot;&quot;  # 测速用的文件地址

# ========================== 删除旧的 CSV 文件 ==========================
Write-Host &quot;[INFO] 删除旧的 result.csv 文件...&quot;
if (Test-Path $csvFile) {
    Remove-Item $csvFile
}

# ========================== 开始测速 ==========================
Write-Host &quot;[INFO] 开始测速...&quot;

# 设置 cfst.exe 参数
$currentHour = (Get-Date).Hour

if ($currentHour -ge 19 -and $currentHour -lt 24) {
    # 晚高峰时段的参数
    $cfstArgs = &quot;-n 800 -t 8 -dn 10 -dt 10 -tp 443 -tl 300 -tlr 0.5 -sl 0.01 -p 10 -url $url -o result.csv&quot;
} else {
    # 平时的参数
    $cfstArgs = &quot;-n 800 -t 4 -dn 10 -dt 10 -tp 443 -tl 300 -tlr 0.5 -sl 0.01 -p 10 -url $url -o result.csv&quot;
}

# 在新的 PowerShell 窗口运行 cfst.exe
Start-Process powershell -ArgumentList &quot;-NoExit&quot;, &quot;-Command&quot;, &quot;&amp; &#039;$cfstPath&#039; $cfstArgs&quot;

# 等待 result.csv 文件生成
$timeout = 900  # 设置最大等待时间 15 分钟
$startTime = Get-Date
while (-not (Test-Path $csvFile)) {
    $elapsedTime = (Get-Date) - $startTime
    if ($elapsedTime.TotalSeconds -gt $timeout) {
        Write-Host &quot;[ERROR] 等待时间超过 15 分钟，未生成 result.csv 文件&quot;
        exit
    }
    Write-Host &quot;[INFO] 等待 result.csv 文件生成...&quot;
    Start-Sleep -Seconds 10
}

# ========================== 读取 CSV 文件 ==========================
Write-Host &quot;[INFO] 读取 result.csv 文件...&quot;
$csvContent = Import-Csv -Path $csvFile

# 选择最快的 IP
$bestIp = $csvContent | Sort-Object { [double]$_.&#039;下载速度(MB/s)&#039; } -Descending | Select-Object -First 1

if ($bestIp) {
    Write-Host &quot;[INFO] 选择的 IP: $($bestIp.&#039;IP 地址&#039;) SPEED: $($bestIp.&#039;下载速度(MB/s)&#039;)&quot;
} else {
    Write-Host &quot;[ERROR] 找不到有效的 IP 地址&quot;
    exit
}

# ========================== 更新 DNS 记录 ==========================
Write-Host &quot;[INFO] 准备更新 DNS，IP 地址: $($bestIp.&#039;IP 地址&#039;)&quot;
$recordUrl = &quot;https://api.cloudflare.com/client/v4/zones/$zoneId/dns_records?name=$recordName&quot;
$headers = @{
    &quot;Authorization&quot; = &quot;Bearer $apiToken&quot;
    &quot;Content-Type&quot;  = &quot;application/json&quot;
}

$response = Invoke-RestMethod -Uri $recordUrl -Headers $headers -Method Get

if ($response.success -and $response.result.Count -gt 0) {
    $recordId = $response.result[0].id

    # 更新 DNS 记录
    $updateUrl = &quot;https://api.cloudflare.com/client/v4/zones/$zoneId/dns_records/$recordId&quot;
    $body = @{
        &quot;type&quot;    = &quot;A&quot;
        &quot;name&quot;    = $recordName
        &quot;content&quot; = $bestIp.&#039;IP 地址&#039;
        &quot;ttl&quot;     = 60
        &quot;proxied&quot; = $false
    } | ConvertTo-Json

    $updateResponse = Invoke-RestMethod -Uri $updateUrl -Headers $headers -Method Put -Body $body

    if ($updateResponse.success) {
        Write-Host &quot;[INFO] DNS 更新成功&quot;
    } else {
        Write-Host &quot;[ERROR] 更新 DNS 失败: $($updateResponse.errors)&quot;
    }
} else {
    Write-Host &quot;[ERROR] 获取 DNS 记录失败&quot;
    exit
}

# ========================== 上传结果到 Worker ==========================
Write-Host &quot;[INFO] 上传数据到 Worker...&quot;

$jsonArray = @()
foreach ($row in $csvContent) {
    $jsonArray += @{
        &quot;ip&quot;          = $row.&#039;IP 地址&#039;
        &quot;speed&quot;       = $row.&#039;下载速度(MB/s)&#039;
        &quot;latency&quot;     = $row.&#039;平均延迟&#039;
        &quot;packetLoss&quot;  = $row.&#039;丢包率&#039;
        &quot;region&quot;      = $row.&#039;地区码&#039;
        &quot;sent&quot;        = $row.&#039;已发送&#039;
        &quot;received&quot;    = $row.&#039;已接收&#039;
        &quot;time&quot;        = (Get-Date).ToString(&quot;yyyy-MM-dd HH:mm:ss&quot;)
    }
}

# 转换为 JSON 格式
$jsonBody = $jsonArray | ConvertTo-Json -Depth 4

try {
    $uploadResponse = Invoke-RestMethod -Uri $uploadUrl -Method Post -Headers @{
        &quot;Authorization&quot; = $authKey
        &quot;Content-Type&quot;  = &quot;application/json&quot;
    } -Body $jsonBody

    if ($uploadResponse.success) {
        Write-Host &quot;[INFO] 数据上传成功&quot;
    } else {
        Write-Host &quot;[ERROR] 数据上传失败: $($uploadResponse.errors)&quot;
    }
} catch {
    Write-Host &quot;[ERROR] 上传失败: $_&quot;
}

# 防止脚本结束，保持当前窗口打开
Write-Host &quot;[INFO] 脚本执行完成&quot;
Read-Host &quot;按任意键退出&quot;
</code></pre><p>后端是部署在cloudfalre的worker，需要绑定一个kv，kv命名是IP_KV</p><p>tg通知的话，也还需要在变量里面添加变量名，TG_BOT_TOKEN tg机器人api，TG_CHAT_ID tg用户id</p><p>AUTH_KEY 可选，用户上传接口验证的密钥</p><h3>CF的woker代码</h3><pre><code>// ================= 配置 =================
const CONFIG = {
  // 节点地区映射
  REGION_MAP: {
    HKG: &quot;香港&quot;, KHH: &quot;高雄&quot;, NRT: &quot;东京&quot;, LAX: &quot;洛杉矶&quot;,
    SEA: &quot;西雅图&quot;, SJC: &quot;圣何塞&quot;, FRA: &quot;法兰克福&quot;,
    MAD: &quot;马德里&quot;, SIN: &quot;新加坡&quot;, CAN: &quot;广州&quot;, SHA: &quot;上海&quot;
  },
  MAX_NODES_DISPLAY: 10,             // Telegram 最多显示节点数量
  DATA_RETENTION_MS: 24 * 60 * 60 * 1000, // 节点数据保留 24 小时
  BAR_MAX_LEN: 5,                    // Telegram 条形图长度
  NODE_ACCESS_INTERVAL: 30 * 1000    // 节点接口访问最小间隔 30 秒
};

// ================= 获取北京时间 =================
const getBJTime = () =&gt; new Date(Date.now() + 8 * 3600 * 1000);

// ================= Telegram 消息生成函数（等宽条形图） =================
function generateTGMessageText(data) {
  if (!data || data.length === 0)
    return &quot;❌ Cloudflare 优选 IP\n\n暂无有效数据&quot;;

  // 1. 排序并取前 MAX_NODES_DISPLAY 条
  const sortedData = [...data]
    .map(i =&gt; ({ ip: String(i.ip), speed: parseFloat(i.speed) || 0 }))
    .sort((a, b) =&gt; b.speed - a.speed)
    .slice(0, CONFIG.MAX_NODES_DISPLAY);

  const maxSpeed = sortedData[0].speed;
  const barLen = CONFIG.BAR_MAX_LEN;

  // 2. 构建条形图行
  const nodeLines = sortedData.map(i =&gt; {
    const ratio = maxSpeed &gt; 0 ? i.speed / maxSpeed : 0;
    let fill = Math.round(ratio * barLen);
    if (fill &lt; 1) fill = 1;

    let block;
    if (ratio &gt; 0.7) block = &quot;█&quot;;       // 高速
    else if (ratio &gt; 0.3) block = &quot;▓&quot;;  // 中速
    else block = &quot;▒&quot;;                    // 低速

    const bar = block.repeat(fill).padEnd(barLen, &quot; &quot;);
    const ip = i.ip.padEnd(16, &quot; &quot;);
    const speed = i.speed.toFixed(2).padStart(6, &quot; &quot;);
    return `${ip}${bar} ${speed} MB/s`;
  }).join(&quot;\n&quot;);

  const fastest = sortedData[0];
  const slowest = sortedData[sortedData.length - 1];
  const timeStr = getBJTime().toISOString().replace(&quot;T&quot;, &quot; &quot;).substring(0, 16);

  // 3. 返回 Telegram 消息
  return `✅ Cloudflare 优选 IP 更新通知

⚡️ 最快： ${fastest.ip} - ${fastest.speed.toFixed(2)} MB/s
☁️ 最慢： ${slowest.ip} - ${slowest.speed.toFixed(2)} MB/s

🕙 更新时间： ${timeStr}
&lt;code&gt;
${nodeLines}
&lt;/code&gt;`;
}

// ================= HTML 页面渲染 =================
function renderHTML(list) {
  const updateTime = list.length &gt; 0 ? list[0].time : &quot;-&quot;;

  // 计算最大速度，用于条形图比例
  const maxSpeed = list.length &gt; 0 ? Math.max(...list.map(i =&gt; i.speed)) : 0;

  // 生成每个节点卡片 HTML
  const cards = list.sort((a, b) =&gt; b.speed - a.speed)
    .map((i, idx) =&gt; {
      const widthPct = maxSpeed &gt; 0 ? Math.round((i.speed / maxSpeed) * 100) : 0;
      return `
      &lt;div class=&quot;card&quot; onclick=&quot;copyToClipboard(&#039;${i.ip}&#039;)&quot;&gt;
        &lt;div class=&quot;card-header&quot;&gt;
          &lt;span class=&quot;rank&quot;&gt;#${idx + 1}&lt;/span&gt;
          &lt;span class=&quot;region&quot;&gt;${CONFIG.REGION_MAP[i.region] || i.region || &quot;Any&quot;}&lt;/span&gt;
        &lt;/div&gt;
        &lt;div class=&quot;ip&quot;&gt;${i.ip}&lt;/div&gt;
        &lt;div class=&quot;speed&quot;&gt;${i.speed} MB/s&lt;/div&gt;
        &lt;div class=&quot;latency&quot;&gt;${i.latency} ms&lt;/div&gt;
        &lt;div class=&quot;card-footer&quot;&gt;点击复制 IP&lt;/div&gt;
      &lt;/div&gt;`;
    }).join(&quot;&quot;);

  return `&lt;!DOCTYPE html&gt;
&lt;html lang=&quot;zh-CN&quot;&gt;
&lt;head&gt;
&lt;meta charset=&quot;utf-8&quot;&gt;
&lt;meta name=&quot;viewport&quot; content=&quot;width=device-width, initial-scale=1&quot;&gt;
&lt;title&gt;Cloudflare 优选 IP&lt;/title&gt;
&lt;style&gt;
  :root {
    --primary-color: #4caf50;
    --secondary-color: #f3f6f9;
    --card-bg: #ffffff;
    --text-color: #333;
    --muted-color: #888;
    --highlight-color: #f3f8fb;
    --shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    --hover-shadow: 0 8px 16px rgba(0, 0, 0, 0.15);
  }

  * { box-sizing: border-box; }
  body {
    margin: 0;
    padding: 20px;
    font-family: &#039;Segoe UI&#039;, Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(145deg, #e0f7fa, #ffffff);
    color: var(--text-color);
  }
  .container { max-width: 1200px; margin: 0 auto; }
  .header { text-align: center; margin-bottom: 40px; }
  .header h1 { font-size: 2rem; color: var(--primary-color); }
  .header p { font-size: 0.9rem; color: var(--muted-color); }

  .grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 20px; }

  /* 卡片样式 */
  .card {
    background-color: var(--card-bg);
    border-radius: 12px;
    padding: 20px;
    box-shadow: var(--shadow);
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
  }
  .card:hover { transform: translateY(-5px); box-shadow: var(--hover-shadow); }

  .card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
  }
  .rank {
    font-size: 0.8rem;
    font-weight: bold;
    color: var(--primary-color);
    background: var(--highlight-color);
    padding: 6px 12px;
    border-radius: 20px;
  }
  .region {
    font-size: 0.8rem;
    color: #1e40af;
    background: #e0e7ff;
    padding: 6px 12px;
    border-radius: 12px;
  }

  .ip {
    font-family: &#039;Courier New&#039;, Courier, monospace;
    font-size: 1.2rem;
    font-weight: 600;
    text-align: center;
    margin-bottom: 14px;
  }

  .speed {
    font-size: 2rem;
    font-weight: bold;
    color: var(--primary-color);
    text-align: center;
    margin: 12px 0;
  }

  .latency {
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--muted-color);
    text-align: center;
  }

  .card-footer {
    text-align: center;
    font-size: 0.75rem;
    color: var(--muted-color);
    margin-top: 14px;
  }

  #toast {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--primary-color);
    color: white;
    padding: 12px 20px;
    border-radius: 20px;
    font-size: 0.85rem;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease, transform 0.3s ease;
  }
  #toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(-6px);
  }
&lt;/style&gt;
&lt;script&gt;
  // 复制 IP 并显示 Toast 提示
  function copyToClipboard(text) {
    navigator.clipboard.writeText(text).then(() =&gt; {
      const toast = document.getElementById(&quot;toast&quot;);
      toast.classList.add(&quot;show&quot;);
      setTimeout(() =&gt; toast.classList.remove(&quot;show&quot;), 1800);
    });
  }
&lt;/script&gt;
&lt;/head&gt;
&lt;body&gt;
&lt;div class=&quot;container&quot;&gt;
  &lt;div class=&quot;header&quot;&gt;
    &lt;h1&gt;Cloudflare 优选 IP&lt;/h1&gt;
    &lt;p&gt;最后更新 · ${updateTime}&lt;/p&gt;
  &lt;/div&gt;
  &lt;div class=&quot;grid&quot;&gt;
    ${cards || &#039;&lt;div style=&quot;grid-column: 1/-1; text-align:center; color:#9ca3af; padding:60px;&quot;&gt;暂无数据&lt;/div&gt;&#039;}
  &lt;/div&gt;
&lt;/div&gt;
&lt;div id=&quot;toast&quot;&gt;IP 已复制&lt;/div&gt;
&lt;/body&gt;
&lt;/html&gt;`;
}

// ================= Worker 主逻辑 =================
export default {
  async fetch(request, env) {
    const { pathname } = new URL(request.url);

    // ---------- 上传测速数据接口 ---------- 
    if (pathname === &quot;/api/upload&quot; &amp;&amp; request.method === &quot;POST&quot;) {
      try {
        const auth = request.headers.get(&quot;Authorization&quot;);
        if (env.AUTH_KEY &amp;&amp; auth !== env.AUTH_KEY)
          return new Response(&quot;Unauthorized&quot;, { status: 401 });

        const rawData = await request.json();
        if (!Array.isArray(rawData)) throw new Error(&quot;Invalid format&quot;);

        const now = getBJTime().toISOString();
        const cleanData = rawData.map(i =&gt; ({
          ip: i.ip, speed: i.speed, latency: i.latency, region: i.region, time: now.replace(&quot;T&quot;, &quot; &quot;).substring(0, 16)
        }));

        // 每次上传的数据都完全覆盖之前的数据
        await env.SPEED_TEST_KV.put(&quot;speed_test_data&quot;, JSON.stringify(cleanData));

        // 发送 Telegram 消息
        await Promise.allSettled([
          fetch(`https://api.telegram.org/bot${env.TG_BOT_TOKEN}/sendMessage`, {
            method: &quot;POST&quot;,
            headers: { &quot;Content-Type&quot;: &quot;application/json&quot; },
            body: JSON.stringify({
              chat_id: env.TG_CHAT_ID,
              text: generateTGMessageText(cleanData),
              parse_mode: &quot;HTML&quot;,
              disable_notification: true
            })
          }),
        ]);

        return new Response(JSON.stringify({ success: true }), {
          headers: { &quot;Content-Type&quot;: &quot;application/json; charset=utf-8&quot; }
        });

      } catch (e) {
        return new Response(JSON.stringify({ error: e.message }), {
          status: 400,
          headers: { &quot;Content-Type&quot;: &quot;application/json; charset=utf-8&quot; }
        });
      }
    }

    // ---------- 获取节点数据接口 ---------- 
    if (pathname === &quot;/api/nodes&quot;) {
      const nowTs = Date.now();
      const clientIP = request.headers.get(&quot;CF-Connecting-IP&quot;) || &quot;unknown&quot;;

      const rawAccess = await env.SPEED_TEST_KV.get(&quot;nodes_access_map&quot;);
      let accessMap = rawAccess ? JSON.parse(rawAccess) : {};

      // 删除过期访问记录
      for (let ip in accessMap)
        if (nowTs - accessMap[ip] &gt; CONFIG.NODE_ACCESS_INTERVAL) delete accessMap[ip];

      // 检查访问频率
      if (accessMap[clientIP])
        return new Response(JSON.stringify({ success: false, message: &quot;请30秒后再请求&quot; }), {
          headers: { &quot;Content-Type&quot;: &quot;application/json; charset=utf-8&quot; }
        });

      // 更新访问时间
      accessMap[clientIP] = nowTs;
      await env.SPEED_TEST_KV.put(&quot;nodes_access_map&quot;, JSON.stringify(accessMap));

      // 获取 24 小时内有效节点数据
      const raw = await env.SPEED_TEST_KV.get(&quot;speed_test_data&quot;);
      let list = raw ? JSON.parse(raw) : [];
      list = list.filter(i =&gt; nowTs - new Date(i.time).getTime() &lt; CONFIG.DATA_RETENTION_MS);

      return new Response(JSON.stringify({ success: true, data: list }), {
        headers: { &quot;Content-Type&quot;: &quot;application/json; charset=utf-8&quot; }
      });
    }

    // ---------- 网页端展示 ---------- 
    if (pathname === &quot;/&quot;) {
      const raw = await env.SPEED_TEST_KV.get(&quot;speed_test_data&quot;) || &quot;[]&quot;;
      return new Response(renderHTML(JSON.parse(raw)), {
        headers: { &quot;Content-Type&quot;: &quot;text/html; charset=UTF-8&quot; }
      });
    }

    // ---------- 404 ---------- 
    return new Response(&quot;Not Found&quot;, { status: 404 });
  }
};
</code></pre><h2>三、Linux版</h2><p>1.官方安装说明</p><pre><code># 如果是第一次使用，则建议创建新文件夹（后续更新时，跳过该步骤）
mkdir cfst

# 进入文件夹（后续更新，只需要从这里重复下面的下载、解压命令即可）
cd cfst

# 下载 CFST 压缩包（自行根据需求替换 URL 中 [版本号] 和 [文件名]）
wget -N https://github.com/XIU2/CloudflareSpeedTest/releases/download/v2.3.4/cfst_linux_amd64.tar.gz
# 如果你是在国内网络环境中下载，那么请使用下面这几个镜像加速之一：
# wget -N https://ghfast.top/https://github.com/XIU2/CloudflareSpeedTest/releases/download/v2.3.4/cfst_linux_arm64.tar.gz
# wget -N https://wget.la/https://github.com/XIU2/CloudflareSpeedTest/releases/download/v2.3.4/cfst_linux_arm64.tar.gz
# wget -N https://ghproxy.net/https://github.com/XIU2/CloudflareSpeedTest/releases/download/v2.3.4/cfst_linux_arm64.tar.gz
# wget -N https://gh-proxy.com/https://github.com/XIU2/CloudflareSpeedTest/releases/download/v2.3.4/cfst_linux_arm64.tar.gz
# wget -N https://hk.gh-proxy.com/https://github.com/XIU2/CloudflareSpeedTest/releases/download/v2.3.4/cfst_linux_arm64.tar.gz
# 如果下载失败的话，尝试删除 -N 参数（如果是为了更新，则记得提前删除旧压缩包 rm cfst_linux_amd64.tar.gz ）

# 解压（不需要删除旧文件，会直接覆盖，自行根据需求替换 文件名）
tar -zxf cfst_linux_amd64.tar.gz

# 赋予执行权限
chmod +x cfst

# 运行（不带参数）
./cfst

# 运行（带参数示例）
./cfst -tl 200 -dn 20</code></pre><p>在解压的文件里面，新建一个sh文件run_cf_ddns.sh</p><p>需要修改的内容都在配置信息里面</p><pre><code>API_TOKEN # Cloudflare API Token，必须有 Zone.DNS:Edit 权限
ZONE_ID # Cloudflare Zone ID
RECORD_NAME # 要更新的域名</code></pre><p>记得给文件添加可执行权限，chmod 777 run_cf_ddns.sh，然后运行看看效果./run_cf_ddns.sh</p><pre><code>#!/bin/bash

# ================= 配置信息 =================
# Cloudflare API Token，必须有 Zone.DNS:Edit 权限
API_TOKEN=&quot;&quot;
# Cloudflare Zone ID
ZONE_ID=&quot;&quot;
# 要更新的域名
RECORD_NAME=&quot;&quot;
# 测速url
SPEED_URL=&quot;&quot;

# ================= cfst 参数 =================
# 定义平时参数
CFST_PARAMS_DAY=&quot;-n 600 -t 4 -dn 10 -dt 15 -tp 443 -url $SPEED_URL -tl 120 -tll 40 -tlr 0.5 -p 10 -sl 1 -o result.csv&quot;
# 定义晚高峰参数
CFST_PARAMS_PEAK=&quot;-n 600 -t 6 -dn 10 -dt 15 -tp 443 -url $SPEED_URL -tl 200 -tll 40 -tlr 1 -p 10 -sl 1 -o result.csv&quot;

# 根据当前时间判断使用哪一套参数
current_hour=$(date +%H)
if [ &quot;$current_hour&quot; -ge 20 ] &amp;&amp; [ &quot;$current_hour&quot; -lt 24 ]; then
    CFST_PARAMS=&quot;$CFST_PARAMS_PEAK&quot;  # 晚高峰使用晚高峰参数
else
    CFST_PARAMS=&quot;$CFST_PARAMS_DAY&quot;   # 非高峰期使用平时参数
fi

echo &quot;使用 cfst 参数: $CFST_PARAMS&quot;
# ============================================

# ================= 防止重复运行逻辑 =================
LOCK_FILE=&quot;/tmp/cfst_ddns_update.lock&quot;
LOCK_TIMEOUT=900  # 15分钟超时

# 使用文件描述符 200 绑定锁文件
exec 200&gt;&quot;$LOCK_FILE&quot;

# 尝试获取排他锁 (-n 表示非阻塞，如果失败立即返回)
if ! flock -n 200; then
    echo &quot;--- [$(date &#039;+%Y-%m-%d %H:%M:%S&#039;)] 错误: 另一个脚本实例正在运行，本次任务跳过 ---&quot;
    exit 0
fi

# 设置超时控制：超过15分钟自动解除锁并停止脚本
{
    sleep &quot;$LOCK_TIMEOUT&quot; &amp;&amp; echo &quot;--- [$(date &#039;+%Y-%m-%d %H:%M:%S&#039;)] 错误: 超过 15 分钟未完成任务，自动解锁并退出 ---&quot; &amp;&amp; flock -u 200 &amp;&amp; exit 1
} &amp;

# 脚本的主要任务处理
echo &quot;--- [$(date &#039;+%Y-%m-%d %H:%M:%S&#039;)] 正在执行任务 ---&quot;
# 任务代码...

# 脚本任务完成后解除锁
flock -u 200
echo &quot;--- [$(date &#039;+%Y-%m-%d %H:%M:%S&#039;)] 任务完成，已释放锁 ---&quot;
# ===================================================

# 获取脚本所在绝对路径
BASE_DIR=$(cd &quot;$(dirname &quot;$0&quot;)&quot;; pwd)
cd &quot;$BASE_DIR&quot; || exit 1
RESULT_FILE=&quot;$BASE_DIR/result.csv&quot;

echo &quot;--- 任务开始: $(date &#039;+%Y-%m-%d %H:%M:%S&#039;) ---&quot;

# 1. 环境清理
[ -f &quot;$RESULT_FILE&quot; ] &amp;&amp; rm -f &quot;$RESULT_FILE&quot;

# 2. 执行测速
if [ -f &quot;./cfst&quot; ]; then
    echo &quot;[步骤1/4] 正在运行 cfst 测速...&quot;
    chmod +x ./cfst
    ./cfst $CFST_PARAMS
else
    echo &quot;错误: 目录下未找到 cfst 执行文件&quot;
    exit 1
fi

# 3. 结果校验与提取
if [ ! -s &quot;$RESULT_FILE&quot; ]; then
    echo &quot;错误: 测速失败，未生成有效的 result.csv&quot;
    exit 1
fi

READ_DATA=$(awk -F, &#039;NR==2 {print $1,$6}&#039; &quot;$RESULT_FILE&quot;)
read -r IP SPEED &lt;&lt;&lt; &quot;$READ_DATA&quot;

CHECK_RESULT=$(echo &quot;$SPEED&quot; | awk &#039;{if($1 &lt;= 0.01) print &quot;stop&quot;; else print &quot;go&quot;}&#039;)

if [ &quot;$CHECK_RESULT&quot; == &quot;stop&quot; ] || [ -z &quot;$IP&quot; ]; then
    echo &quot;停止更新: 速度过低 ($SPEED MB/s) 或未获取到 IP。&quot;
    exit 0
fi

echo &quot;[步骤2/4] 测速通过！最优 IP: $IP, 速度: $SPEED MB/s&quot;

# 4. 更新 Cloudflare
echo &quot;[步骤3/4] 正在获取 Record ID...&quot;
RECORD_INFO=$(curl -s -X GET &quot;https://api.cloudflare.com/client/v4/zones/$ZONE_ID/dns_records?name=$RECORD_NAME&quot; \
     -H &quot;Authorization: Bearer $API_TOKEN&quot; \
     -H &quot;Content-Type: application/json&quot;)

RECORD_ID=$(echo &quot;$RECORD_INFO&quot; | sed -n &#039;s/.*&quot;id&quot;:&quot;\([^&quot;]*\)&quot;.*/\1/p&#039; | head -n 1)

if [ -z &quot;$RECORD_ID&quot; ] || [ ${#RECORD_ID} -lt 10 ]; then
    echo &quot;错误: 无法获取 Record ID。&quot;
    exit 1
fi

echo &quot;[步骤4/4] 正在同步 DNS 记录...&quot;
UPDATE_RES=$(curl -s -X PUT &quot;https://api.cloudflare.com/client/v4/zones/$ZONE_ID/dns_records/$RECORD_ID&quot; \
     -H &quot;Authorization: Bearer $API_TOKEN&quot; \
     -H &quot;Content-Type: application/json&quot; \
     --data &quot;{\&quot;type\&quot;:\&quot;A\&quot;,\&quot;name\&quot;:\&quot;$RECORD_NAME\&quot;,\&quot;content\&quot;:\&quot;$IP\&quot;,\&quot;ttl\&quot;:60,\&quot;proxied\&quot;:false}&quot;)

if [[ &quot;$UPDATE_RES&quot; == *&quot;\&quot;success\&quot;:true&quot;* ]]; then
    echo &quot;==========================================&quot;
    echo &quot;  更新成功！ IP: $IP&quot;
    echo &quot;==========================================&quot;
else
    echo &quot;更新失败！&quot;
    echo &quot;$UPDATE_RES&quot;
    exit 1
fi

echo &quot;--- 任务结束: $(date &#039;+%Y-%m-%d %H:%M:%S&#039;) ---&quot;
</code></pre>
]]></content:encoded>
<slash:comments>0</slash:comments>
<comments>https://xmix.one/archives/132/#comments</comments>
<wfw:commentRss>https://xmix.one/feed/archives/132/</wfw:commentRss>
</item>
<item>
<title>Linux部署yt-dtl，下载Youtube</title>
<link>https://xmix.one/archives/131/</link>
<guid>https://xmix.one/archives/131/</guid>
<pubDate>Thu, 19 Feb 2026 07:57:00 +0000</pubDate>
<dc:creator>冷清寒</dc:creator>
<category><![CDATA[默认分类]]></category>
<description><![CDATA[一、安装 yt-dlp（推荐官方二进制方式）下载最新版sudo curl -L https://github.com/yt-dlp/yt-dlp/releases/latest/download...]]></description>
<content:encoded xml:lang="zh-CN"><![CDATA[
<h3>一、安装 yt-dlp（推荐官方二进制方式）</h3><ol><li><p>下载最新版</p><pre><code>sudo curl -L https://github.com/yt-dlp/yt-dlp/releases/latest/download/yt-dlp -o /usr/local/bin/yt-dlp</code></pre></li><li><p>赋予执行权限</p><pre><code>sudo chmod a+rx /usr/local/bin/yt-dlp</code></pre></li><li><p>测试</p><pre><code>yt-dlp --version</code></pre><p>如果能显示版本号，说明安装成功。</p></li></ol><h3>二、安装 ffmpeg（必须）</h3><p>用于合并视频音频：</p><pre><code>sudo apt update
sudo apt install ffmpeg -y</code></pre><p>测试：</p><pre><code>ffmpeg -version</code></pre><h3>三、下载命令</h3><pre><code>yt-dlp -f &quot;bestvideo+bestaudio/best&quot; \
--merge-output-format mp4 \
URL
</code></pre>
]]></content:encoded>
<slash:comments>0</slash:comments>
<comments>https://xmix.one/archives/131/#comments</comments>
<wfw:commentRss>https://xmix.one/feed/archives/131/</wfw:commentRss>
</item>
<item>
<title>部署 WireGuard 实现NAS安全组网</title>
<link>https://xmix.one/archives/130/</link>
<guid>https://xmix.one/archives/130/</guid>
<pubDate>Sun, 08 Feb 2026 08:27:00 +0000</pubDate>
<dc:creator>冷清寒</dc:creator>
<category><![CDATA[默认分类]]></category>
<description><![CDATA[1. 前期准备DDNS 解析：解析一个域名到你的公网 IP。客户端准备：手机/PC 端下载安装 WireGuard。密码处理（关键）：准备好你的明文密码。访问 bcrypt.online 生成 ...]]></description>
<content:encoded xml:lang="zh-CN"><![CDATA[
<h2>1. 前期准备</h2><p>DDNS 解析：解析一个域名到你的公网 IP。</p><p>客户端准备：手机/PC 端下载安装 WireGuard。</p><p>密码处理（关键）：</p><ul><li>准备好你的明文密码。</li><li>访问 bcrypt.online 生成 Hash 串。</li><li>转义处理：在 Docker Compose 中 <code>$</code> 是变量符，必须将 Hash 串中所有的 <code>$</code> 替换为 <code>$$</code>。</li></ul><h2>2. Docker 部署</h2><p>在NAS中新建目录 /vol1/1000/app/wireguard，创建 docker-compose.yml。</p><p>配置要点：</p><p>替换 WG_HOST 为你的域名。</p><p>替换 PASSWORD_HASH 为刚才生成的 Hash。</p><p>WG_DEFAULT_ADDRESS 建议修改为非家庭常用网段（如 10.8.0.x），避免路由冲突。</p><pre><code>services:
  wg-easy:
    image: ghcr.io/wg-easy/wg-easy
    container_name: wg-easy
    environment:
      - WG_HOST=你的公网域名或公网IP
      - PASSWORD_HASH=管理后台密码 (Bcrypt Hash)，注意 Docker Compose 中 $ 需写成 $$
      
      # 网络配置
      - WG_PORT=51820
      - WG_DEFAULT_ADDRESS=10.8.0.x
      - WG_DEFAULT_DNS=223.5.5.5, 223.6.6.6
      - WG_ALLOWED_IPS=0.0.0.0/0, ::/0
      - WG_MTU=1420
      
    volumes:
      - ./config:/etc/wireguard
    ports:
      - &quot;51820:51820/udp&quot; # 隧道通信
      - &quot;51821:51821/tcp&quot; # Web 管理面板
    restart: unless-stopped
    cap_add:
      - NET_ADMIN
      - SYS_MODULE
    sysctls:
      - net.ipv4.ip_forward=1
      - net.ipv4.conf.all.src_valid_mark=1</code></pre><p>启动容器后，访问 <a href="http://NAS_IP:51821/">http://NAS_IP:51821/</a> 进入后台（密码为 Hash 前的明文）。</p><h2>3. 端口转发</h2><p>进入主路由后台，添加端口映射：</p><p>外部端口：51820<br>内部端口：51820<br>协议：UDP (注意：WireGuard 仅使用 UDP)</p><h2>4. 客户端连接</h2><p>在 Web 后台点击 New Client，命名（如 iPhone）。<br>打开手机 WireGuard App，扫描屏幕上的二维码。<br>断开手机 WiFi，使用 5G 流量测试。开启连接，尝试访问 NAS 内网 IP。</p><h2>5. 为什么选择 WireGuard？</h2><ol><li>安全性：隐形防御<br>端口映射 (5666)：像家门临街，虽然有锁，但小偷知道门在哪，随时能尝试撬锁或利用漏洞（如 fnOS 事件）。<br>WireGuard (51820)：在攻击者眼中是“丢包”的黑洞。没有正确的私钥，服务器对任何扫描都不予回应。坏人连门都找不到，无从下手。</li><li>功能性：全屋互联<br>端口映射：要在墙上凿无数个洞。想用 NAS 凿一个，想看监控又凿一个。想用局域网打印机？没映射就无法访问。<br>WireGuard：直接把你要到了客厅。连上 VPN 等同于设备物理接入了家庭 WiFi。NAS、路由器后台、PC 远程桌面、打印机，想连谁连谁。</li><li>维护性：收敛入口<br>传统方式：维护多个端口，需确保每个服务的 Auth 都足够强壮。</li></ol><p>WireGuard：只需守住这唯一的入口。只要隧道安全，内网所有弱密码设备皆安全。</p>
]]></content:encoded>
<slash:comments>0</slash:comments>
<comments>https://xmix.one/archives/130/#comments</comments>
<wfw:commentRss>https://xmix.one/feed/archives/130/</wfw:commentRss>
</item>
<item>
<title>Typecho整文件夹迁移后的权限调整</title>
<link>https://xmix.one/archives/129/</link>
<guid>https://xmix.one/archives/129/</guid>
<pubDate>Sat, 07 Feb 2026 16:31:27 +0000</pubDate>
<dc:creator>冷清寒</dc:creator>
<category><![CDATA[默认分类]]></category>
<description><![CDATA[对于采用SQLITE的Typecho，在对整个文件夹先压缩再上传的迁移，迁移后会出现访问500错误。其主要原因是*.db 的属主是 root:root，而 PHP-FPM 是 www-data ...]]></description>
<content:encoded xml:lang="zh-CN"><![CDATA[
<p>对于采用SQLITE的Typecho，在对整个文件夹先压缩再上传的迁移，迁移后会出现访问500错误。其主要原因是*.db 的属主是 root:root，而 PHP-FPM 是 www-data 在跑，因此需要重新调整权限。</p><h3>1. 把 usr 目录和数据库交给 www-data</h3><pre><code>chown -R www-data:www-data /www/wwwroot/xxx.xxx/usr</code></pre><h3>2. 给 usr 目录写权限（SQLite 需要）</h3><pre><code>chmod 775 /www/wwwroot/xxx.xxx/usr</code></pre><h3>3. 确保数据库文件可写</h3><pre><code>chmod 664 /www/wwwroot/xxx.xxx/usr/xmix.db</code></pre>
]]></content:encoded>
<slash:comments>0</slash:comments>
<comments>https://xmix.one/archives/129/#comments</comments>
<wfw:commentRss>https://xmix.one/feed/archives/129/</wfw:commentRss>
</item>
</channel>
</rss>