<?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:atom="http://www.w3.org/2005/Atom"
xmlns:slash="http://purl.org/rss/1.0/modules/slash/">
<channel>
<title>向晚时光</title>
<link>https://www.timelate.com/</link>
<description>向晚时光，简单记录兴趣与生活，乐于分享技术教程和软件。</description>
<atom:link href="https://www.timelate.com/rss.xml" rel="self" type="application/rss+xml" />
<lastBuildDate>Sat, 16 May 2026 00:14:09 +0800</lastBuildDate>
<item>
<title>WinSW: 在Windows中安装和运行Komari Agent</title>
<link>https://www.timelate.com/{category}/install-komari-agent-on-windows.html</link>
<guid isPermaLink="false">https://www.timelate.com/{category}/install-komari-agent-on-windows.html</guid>
<pubDate>Wed, 15 Oct 2025 17:56:00 +0800</pubDate>
<dc:creator>Lvv</dc:creator>
<category><![CDATA[笔记]]></category>
<category><![CDATA[WinSW]]></category>
<category><![CDATA[Komari]]></category>
<description><![CDATA[最近把小鸡探针的托管程序从nezha改成了Komari，在挂Window平台时我发现并没有nezha这么方便：要跑PowerShell脚本，虽然能跑，但总感觉差了点意思。本人稍微有点安装洁癖，遂选择手动安装，后续管理以及更新啥的也方便。
开始本来选择用Ns...]]></description>
<content:encoded><![CDATA[
<!--markdown-->最近把小鸡探针的托管程序从nezha改成了Komari，在挂Window平台时我发现并没有nezha这么方便：要跑PowerShell脚本，虽然能跑，但总感觉差了点意思。本人稍微有点安装洁癖，遂选择手动安装，后续管理以及更新啥的也方便。
<p>开始本来选择用Nssm的方式去托管，想到它已经很久没有维护了。后面搜了下替代方案发现WinSw使用xml文件配置管理更优雅直观，遂记录一下，以便日后查阅。</p>
<hr />
<h4>项目地址</h4>
<blockquote>
<p>Komari Agent: <a href="https://github.com/komari-monitor/komari-agent/releases/latest">https://github.com/komari-monitor/komari-agent/releases/latest</a></p>
<p>WinSW: <a href="https://github.com/winsw/winsw/releases/latest">https://github.com/winsw/winsw/releases/latest</a></p>
</blockquote>
<h4>准备工作</h4>
<ol>
<li>
<p><strong>创建目录：</strong>
在一个心仪的位置新建文件夹，用作程序的工作目录。例如我的位置是 <code>D:\Software\komari-agent</code>。</p>
</li>
<li>
<p><strong>获取 Komari Agent 程序：</strong>
从 Komari 的 <a href="https://github.com/komari-monitor/komari-agent/releases/latest">GitHub Releases</a> 页面下载适用于 Windows 的 Agent 版本（通常是 <code>komari-agent-windows-amd64.exe</code>）。下载后，将其放入<code>D:\Software\komari-agent</code>文件夹。</p>
</li>
<li>
<p><strong>获取并重命名 WinSW 程序：</strong>
从 WinSW 的 <a href="https://github.com/winsw/winsw/releases/latest">GitHub Releases</a> 页面下载最新版本的 <code>WinSW-x64.exe</code> 将其重命名为 <code>komari-agent.exe</code> 后一样放入<code>D:\Software\komari-agent</code>文件夹。</p>
</li>
</ol>
<h4>创建配置</h4>
<p>因为 WinSW 会默认加载与它自身文件名相同的 XML 配置文件，所以接下来创建一个 XML 文件，用来告诉<code>komari-agent.exe</code>如何启动和管理 <code>komari-agent-windows-amd64.exe</code>。</p>
<p>在 <code>D:\Software\komari-agent</code> 下新建一个文本并将其命名为 <code>komari-agent.xml</code>（文件名必须与上一步 WinSw 重命名的 exe 文件一致），并键入：</p>
<pre><code>&lt;service&gt;
     &lt;id&gt;komari-agent&lt;/id&gt;
     &lt;name&gt;Komari Agent&lt;/name&gt;
     &lt;description&gt;This is the Komari Agent Manager created by WinSw&lt;/description&gt;
     &lt;executable&gt;%BASE%\komari-agent-windows-amd64.exe&lt;/executable&gt;
     &lt;arguments&gt; -e https://example.com -t your-secret-key --disable-web-ssh --disable-auto-update&lt;/arguments&gt;
     &lt;startmode&gt;Automatic&lt;/startmode&gt;
     &lt;delayedAutoStart&gt;true&lt;/delayedAutoStart&gt;
     &lt;log mode="roll-by-size"&gt;
       &lt;sizeThreshold&gt;10240&lt;/sizeThreshold&gt;
       &lt;keepFiles&gt;8&lt;/keepFiles&gt;
     &lt;/log&gt;
     &lt;onfailure action="restart" delay="5 sec"/&gt;
     &lt;onfailure action="restart" delay="10 sec"/&gt;
   &lt;/service&gt;</code></pre>
<ul>
<li><code>&lt;id&gt;</code>, <code>&lt;name&gt;</code>, <code>&lt;description&gt;</code>：分别是服务的唯一ID、显示名称和描述，清晰明了。</li>
<li><code>&lt;executable&gt;</code>：要运行的程序。这里我用了 %BASE% 这个变量，它代表 WinSW 程序所在的目录（即 D:\Software\komari-agent），这样做的好处是即使你把整个文件夹移动到其他位置，配置依然有效，非常灵活。</li>
<li><code>&lt;argument&gt;</code>：<ul>
<li>将 example.com 替换为你的 Komari 服务端 域名或IP 地址和端口</li>
<li>将 your_secret_key 替换为你在服务端获取的密钥</li>
<li>disable-web-ssh 参数为禁用 Web SSH 功能</li>
<li>disable-auto-update 参数为禁用自动更新Agent</li>
</ul>
</li>
</ul>
<h4>安装及管理</h4>
<p>编辑完成XML文件之后以管理员身份打开命令提示符 (CMD) 或 PowerShell：</p>
<pre><code># 切换到程序工作目录
cd D:\Software\komari-agent
# 安装服务
.\komari-agent.exe install</code></pre>
<p><img src="https://img.timelate.com/i/2025/10/15/53cce2375a38cf8ae600c671356c3b08.webp" alt="image" /></p>
<p>当看到 Service 'Komari Agent (komari-agent)' was installed successfully.的提示时，就代表安装成功了。</p>
<pre><code># 启动服务
.\komari-agent.exe start</code></pre>
<p><img src="https://img.timelate.com/i/2025/10/15/43389163ca6ef2665a7865ff6b908e6b.webp" alt="image" /></p>
<p>现在，服务已经在后台运行了。登录 Komari 服务端后台，应该能看到这台 Windows 主机已经成功上线。</p>
<p>后续的管理命令：</p>
<pre><code># 查看状态
.\komari-agent.exe status
# 停止服务
.\komari-agent.exe stop
# 重启服务
.\komari-agent.exe restart
# 卸载服务
.\komari-agent.exe uninstall</code></pre>
<h4>更新程序</h4>
<p>后续更新版本也十分简单，先<code>.\komari-agent.exe stop</code>然后直接更新替换目录下<code>komari-agent-windows-amd64.exe</code>文件即可，再<code>.\komari-agent.exe restart</code>就完事了。WinSW也是同理。</p>
]]></content:encoded>
<slash:comments>0</slash:comments>
<comments>https://www.timelate.com/{category}/install-komari-agent-on-windows.html#comments</comments>
</item>
<item>
<title>告别繁琐操作：BtCloud 一键更新脚本</title>
<link>https://www.timelate.com/{category}/update-btcloud-one-click.html</link>
<guid isPermaLink="false">https://www.timelate.com/{category}/update-btcloud-one-click.html</guid>
<pubDate>Fri, 01 Aug 2025 11:59:00 +0800</pubDate>
<dc:creator>Lvv</dc:creator>
<category><![CDATA[笔记]]></category>
<category><![CDATA[btcloud]]></category>
<description><![CDATA[>基于开源项目：BtCloud

https://github.com/flucont/btcloud

#!/bin/bash

RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[0;33m'
NC='\0...]]></description>
<content:encoded><![CDATA[
<!--markdown-->>基于开源项目：BtCloud
<blockquote>
<p><a href="https://github.com/flucont/btcloud">https://github.com/flucont/btcloud</a></p>
</blockquote>
<pre><code>#!/bin/bash

RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[0;33m'
NC='\033[0m' # No Color

log_info() {
    echo -e "${GREEN}[INFO] $1${NC}"
}

log_warn() {
    echo -e "${YELLOW}[WARN] $1${NC}"
}

log_error() {
    echo -e "${RED}[ERROR] $1${NC}"
}

check_dependencies() {
    local dependencies=("jq" "wget" "rsync" "curl" "unzip")
    local pkg_manager=""
    local install_cmd=""

    if command -v apt-get &gt;/dev/null 2&gt;&amp;1; then
        pkg_manager="apt-get"
        install_cmd="sudo apt-get install -y"
    elif command -v yum &gt;/dev/null 2&gt;&amp;1; then
        pkg_manager="yum"
        install_cmd="sudo yum install -y"
    elif command -v dnf &gt;/dev/null 2&gt;&amp;1; then
        pkg_manager="dnf"
        install_cmd="sudo dnf install -y"
    else
        log_error "未找到支持的包管理器 (apt/yum/dnf)，请手动安装依赖: ${dependencies[*]}"
        exit 1
    fi

    local need_update=0
    for dep in "${dependencies[@]}"; do
        if ! command -v "$dep" &gt;/dev/null 2&gt;&amp;1; then
            if [ "$pkg_manager" == "apt-get" ] &amp;&amp; [ $need_update -eq 0 ]; then
                sudo apt-get update -y &gt;/dev/null 2&gt;&amp;1
                need_update=1
            fi
            log_info "正在安装依赖 $dep..."
            $install_cmd "$dep" &gt;/dev/null 2&gt;&amp;1
            if ! command -v "$dep" &gt;/dev/null 2&gt;&amp;1; then
                 log_error "依赖 $dep 安装失败，请检查网络或手动安装。"
                 exit 1
            fi
        fi
    done
}

# 检查并安装依赖项
check_dependencies

# 设置替换域名（按需更改）
site_url="https://your-domain.com"
# 设置安装目录（按需更改）
base_dir="www/wwwroot/your-domain.com"
# 版本文件位置
version_file="$base_dir/version.txt"
# 批量替换脚本位置
convert_dir="$base_dir/app/script"

# 获取最新版本
log_info "正在检查最新版本..."
latest_tag=$(curl -s --connect-timeout 10 "https://api.github.com/repos/flucont/btcloud/tags" | jq -r '.[0].name')
# 获取最新版本(国内机器专用)
# latest_tag=$(curl -s --connect-timeout 10 "https://gha.push.ac.cn/repos/flucont/btcloud/tags" | jq -r '.[0].name')
if [[ -z "$latest_tag" || "$latest_tag" == "null" ]]; then
    log_error "无法获取最新版本号，请检查网络连接或 GitHub API 状态。"
    exit 1
fi

# 下载并解压最新版本
download_and_extract() {
    # 构造下载链接
    download_url="https://github.com/flucont/btcloud/releases/download/$latest_tag/btcloud_$latest_tag.zip"
    # 构造下载链接(国内机器专用)
    # download_url="https://ghp.42lab.link/https://github.com/flucont/btcloud/releases/download/$latest_tag/btcloud_$latest_tag.zip"

    temp_work_dir=$(mktemp -d)
    zip_file="$temp_work_dir/btcloud_$latest_tag.zip"
    extract_dir="$temp_work_dir/extract"

    log_info "准备下载版本: $latest_tag"
    log_info "下载地址: $download_url"

    if ! wget -q "$download_url" -O "$zip_file"; then
        log_error "下载失败！"
        rm -rf "$temp_work_dir"
        exit 1
    fi

    log_info "正在解压..."
    mkdir -p "$extract_dir"
    if ! unzip -q "$zip_file" -d "$extract_dir"; then
        log_error "解压失败！"
        rm -rf "$temp_work_dir"
        exit 1
    fi

    if [ "$(ls -A "$extract_dir")" ]; then
        log_info "正在更新文件..."

        mkdir -p "$base_dir"

        # 同步文件 (排除 data 目录)
        rsync -a --exclude="data" "$extract_dir/" "$base_dir/"

        if [ -f "$convert_dir/convert.sh" ]; then
            chmod +x "$convert_dir/convert.sh"
            bash "$convert_dir/convert.sh" "$base_dir/" "$site_url"
        else
             log_warn "未找到 convert.sh，跳过域名替换。"
        fi

        # 替换相关文案
        target_html="$base_dir/app/view/index/download.html"
        if [ -f "$target_html" ]; then
            sed -i 's/&lt;title&gt;宝塔面板安装脚本&lt;\/title&gt;/&lt;title&gt;宝塔面板 - 42Lab专业版&lt;\/title&gt;/' "$target_html"
            sed -i 's/宝塔面板安装脚本/宝塔面板/g' "$target_html"
        fi

        chmod -R 755 "$base_dir"
        chown -R www:www "$base_dir"
        find "$base_dir/" -name ".gitkeep" -exec rm -f {} \;

        echo "BtCloud $latest_tag" &gt; "$version_file"

        log_info "已完成升级！当前版本: BtCloud $latest_tag"
    else
        log_error "解压目录为空，升级失败！"
        rm -rf "$temp_work_dir"
        exit 1
    fi

    # 清理临时文件
    rm -rf "$temp_work_dir"
}

confirm_update() {
    local prompt_msg="$1"
    read -p "$prompt_msg" -n 1 -r
    echo
    if [[ -z "$REPLY" || "$REPLY" =~ ^[Yy]$ ]]; then
        download_and_extract
    else
        log_info "已取消升级。"
    fi
}

if [ ! -f "$version_file" ]; then
    confirm_update "安装目录中未找到版本信息，是否升级至最新版本: BtCloud $latest_tag ? [Y/n] "
else
    current_version=$(cat "$version_file")
    if [[ "BtCloud $latest_tag" != "$current_version" ]]; then
        confirm_update "检测到更新 ($current_version -&gt; BtCloud $latest_tag)，是否升级? [Y/n] "
    else
        log_info "未检测到更新，本地版本为最新版本: $current_version ！"
    fi
fi

</code></pre>
<h1>配置</h1>
<p>自行替换脚本中以下信息：</p>
<ul>
<li><strong><em>site_url:</em></strong> 域名（默认值：<a href="https://your-domain.com">https://your-domain.com</a>）</li>
<li><strong><em>base_dir:</em></strong> BtCloud 安装目录（默认值：/www/wwwroot/your-domain.com）</li>
<li>其他变量（<strong><em>version_file</em></strong>、<strong><em>convert_dir</em></strong>）为版本文件和批量替换脚本的路径，一般无需修改。</li>
<li>替换文案的代码段是修改download页面的标题，自行更改。</li>
<li>国内机器如无法直连github请取消脚本中的相关注释符。</li>
</ul>
<p>修改后脚本会自动按照新路径进行升级操作，并在同步完成后自动替换所有相关的域名配置。</p>
<h1>食用</h1>
<p>假设保存文件名为：btcloud-upgrade.sh</p>
<pre><code>bash btcloud-upgrade.sh
#或者
chmod +x btcloud-upgrade.sh
./btcloud-upgrade.sh</code></pre>
<p>执行脚本后会自动进入交互流程：</p>
<ul>
<li>首次使用：提示安装最新版本</li>
<li>有新版本：询问是否升级</li>
<li>已是最新：直接显示当前版本</li>
</ul>
<p>只需输入 Y 确认，脚本就会自动完成后续所有操作。</p>
<h1>DLC</h1>
<p>这是另一个配套脚本，功能对应BtCloud后台的自动更新功能，单纯是方便自动更新插件后修复/data 目录下文件权限不对的问题。</p>
<pre><code>#!/bin/bash

# Execute the php command
php /www/wwwroot/your-domain.com/think updateall &amp;&amp; php /www/wwwroot/your-domain.com/think clean

# Check the exit status of the previous command
if [ $? -eq 0 ]; then
    # If successful, change the permission of the data directory
    chmod -R 755 /www/wwwroot/your-domain.com/data
    chown -R www:www /www/wwwroot/your-domain.com/data
else
    # If failed, print an error message and exit
    echo "The php command failed. Aborting."
    exit 1
fi
</code></pre>
<p>自行修改脚本中的路径，为实际网站路径（默认值：/www/wwwroot/your-domain.com/），然后扔到Crontab。</p>
<pre><code>crontab -e
</code></pre>
<p>假设保存名字为SyncPlugins.sh，路径在/root</p>
<pre><code>0 12 * * * /bin/bash /root/SyncPlugins.sh</code></pre>
]]></content:encoded>
<slash:comments>1</slash:comments>
<comments>https://www.timelate.com/{category}/update-btcloud-one-click.html#comments</comments>
</item>
<item>
<title>RealM - 搭建安全加密隧道中转TG代理</title>
<link>https://www.timelate.com/{category}/realm-wss-to-socks5.html</link>
<guid isPermaLink="false">https://www.timelate.com/{category}/realm-wss-to-socks5.html</guid>
<pubDate>Thu, 06 Oct 2022 12:00:00 +0800</pubDate>
<dc:creator>Lvv</dc:creator>
<category><![CDATA[笔记]]></category>
<category><![CDATA[realm]]></category>
<category><![CDATA[proxy]]></category>
<description><![CDATA[原因懂的都懂。之前用的方案是Socks5+Gost隧道中转，不过Gost据说有运行久了转发效率会变低（掉速）的小问题，后来Realm合并Kaminari之后支持了隧道加密转发就换了Realm，测试了大半年，运行稳定。
这几天看Loc貌似MJJ被WALL干翻...]]></description>
<content:encoded><![CDATA[
<!--markdown-->原因懂的都懂。之前用的方案是Socks5+Gost隧道中转，不过Gost据说有运行久了转发效率会变低（掉速）的小问题，后来Realm合并Kaminari之后支持了隧道加密转发就换了Realm，测试了大半年，运行稳定。
<p>这几天看Loc貌似MJJ被WALL干翻了一堆花里胡哨的协议，笑~</p>
<hr />
<h4>项目地址</h4>
<blockquote>
<p><a href="https://github.com/zhboner/realm">https://github.com/zhboner/realm</a></p>
</blockquote>
<h4>必要条件</h4>
<ol>
<li>
<p>一台国内鸡鸡作为中转节点（假设IP：1.1.1.1，用于下文配置参考）</p>
</li>
<li>
<p>一台外地鸡鸡作为落地节点（假设IP：2.2.2.2，用于下文配置参考）</p>
</li>
</ol>
<h4>外地鸡配置</h4>
<h5>1. 配置socks</h5>
<p>个人习惯使用X-UI面板</p>
<pre><code>apt install curl -y
bash &lt;(curl -Ls https://raw.githubusercontent.com/vaxilu/x-ui/master/install.sh)</code></pre>
<p>添加一个socks配置仅监听本地端口</p>
<p><img src="https://img.timelate.com/i/2025/07/31/36fab2d88955cf35d44a1ce4c2136492.webp" alt="" /></p>
<h5>2. 配置realm落地wss隧道</h5>
<p>新建一个文件夹，下载realm进去</p>
<pre><code>mkdir /home/RealM
wget -P /home/RealM https://github.com/zhboner/realm/releases/download/v2.4.3/realm-x86_64-unknown-linux-gnu.tar.gz</code></pre>
<p>进目录解压缩</p>
<pre><code>cd /home/RealM
tar -zxvf realm-x86_64-unknown-linux-gnu.tar.gz</code></pre>
<p>给realm执行权限</p>
<pre><code>chmod +x relam</code></pre>
<p><img src="https://img.timelate.com/i/2025/07/31/92b72e5f481c461d7d8b3e3d6c60bbea.webp" alt="" /></p>
<p>新建一个realm配置文件</p>
<pre><code>nano /home/RealM/config.toml</code></pre>
<p>键入</p>
<pre><code>[log]
level = "warn"
output = "/var/log/realm.log"

[network]
no_tcp = false
use_udp = true

[[endpoints]]
listen = "0.0.0.0:20066"
remote = "127.0.0.1:53838"
listen_transport = "ws;host=www.mi.com;path=/;tls;servername=www.mi.com"
</code></pre>
<p><strong><em>上述配置，listen段为中转鸡的传入端口，remote段为上文创建的socks端口，listen_transport段为隧道伪装的domain，自行更改。</em></strong></p>
<p>保存后接着设置realm的systemd方便管理。</p>
<pre><code>nano /etc/systemd/system/realm.service</code></pre>
<p>键入</p>
<pre><code>[Unit]
Description=RealM
After=network.target
Wants=network.target

[Service]
WorkingDirectory=/home/RealM/
ExecStart=/home/RealM/realm -c /home/RealM/config.toml
Restart=on-abnormal
RestartSec=5s
KillMode=mixed

StandardOutput=null
StandardError=syslog

[Install]
WantedBy=multi-user.target</code></pre>
<p><strong><em>自行更改配置中WorkingDirectory/ExecStart段内容为realm所在的路径位置。</em></strong></p>
<p>保存，启动</p>
<pre><code>systemctl daemon-reload
systemctl start realm</code></pre>
<p>检查realm是否成功启动</p>
<pre><code>systemctl status realm</code></pre>
<p><img src="https://img.timelate.com/i/2025/07/31/bf76e460f3906a89faad7f8ebbf583de.webp" alt="" /></p>
<p>设置开机自启</p>
<pre><code>systemctl enable realm</code></pre>
<h5>3. 配置ufw防火墙</h5>
<p>非必要，用于限制入口IP提高安全性</p>
<pre><code>apt update &amp;&amp; apt upgrade -y
apt install ufw -y</code></pre>
<p>完成后启用服务</p>
<pre><code>systemctl enable ufw --now</code></pre>
<p>检查是否成功启用</p>
<pre><code>systemctl status ufw</code></pre>
<p><img src="https://img.timelate.com/i/2025/07/31/eb6874eb537a685bcc12d3ceaa7978b1.webp" alt="" /></p>
<p>先放行SSH端口</p>
<pre><code>ufw allow 22/tcp</code></pre>
<p>开启防火墙</p>
<pre><code>ufw enable</code></pre>
<p>出现提示，键入“Y”</p>
<blockquote>
<p>Command may disrupt existing ssh connections. Proceed with operation (y|n)?</p>
</blockquote>
<p><img src="https://img.timelate.com/i/2025/07/31/e84d49ef79dc4992fe0d4664a498d423.webp" alt="" /></p>
<p>添加规则限制realm转发的端口仅国内鸡的IP(1.1.1.1)能访问</p>
<pre><code>ufw allow from 1.1.1.1 to any port 20066</code></pre>
<p><strong><em>自行更改命令中IP(1.1.1.1)和端口(20066)为你实际所使用的IP/端口。</em></strong></p>
<p>检查一下规则是否添加成功</p>
<pre><code>ufw status numbered</code></pre>
<p><img src="https://img.timelate.com/i/2025/07/31/41f0ae733370a86ca21363c449bafbf1.webp" alt="" /></p>
<h4>国内鸡配置</h4>
<p>配置完外地鸡，国内鸡就很简单了，只需要参考上文安装realm，参考以下配置文件</p>
<pre><code>[log]
level = "warn"
output = "/var/log/realm.log"

[network]
no_tcp = false
use_udp = true

[[endpoints]]
listen = "0.0.0.0:20088"
remote = "2.2.2.2:20066"
remote_transport = "ws;host=www.mi.com;path=/;tls;sni=www.mi.com;insecure"</code></pre>
<p><strong><em>上述配置，listen段为TG代理的连接端口，可自定义。remote段为上文创建的外地鸡的传入端口，listen_transport段为隧道伪装的domain，自行更改。</em></strong></p>
<p>保存后参考上文增加systemd配置并启动</p>
<pre><code>systemctl start realm</code></pre>
<h4>连接测试</h4>
<p>测试环境为移动端，毕竟手机上TG才不方便，总不能时刻挂着V吧，麻烦。</p>
<p><strong><em>侧边栏 → Setting → Data and Storage → Proxy Setting → Add Proxy</em></strong></p>
<p>选择SOCKS5 Proxy，Server填写国内中转鸡的IP(1.1.1.1)，Port填写国内中转鸡设置的连接端口(20088)，Username/Password填写外地落地鸡Socks5的账号密码，保存后勾选Use Proxy，出现Connected大功告成~</p>
<p><img src="https://img.timelate.com/i/2025/07/31/46eac51729c3af824259b9ac1dd14d37.webp" alt="" /></p>
<p>接下来愉快的在TG学习吧~当然，看学习视频的速度取决于国内鸡的上传口子大小及其与外地鸡通信的速度，还取决于是不是TG会员，所以速度方面因鸡而异，此方案优势还是在于上TG方便与稳定。</p>
]]></content:encoded>
<slash:comments>4</slash:comments>
<comments>https://www.timelate.com/{category}/realm-wss-to-socks5.html#comments</comments>
</item>
<item>
<title>Rinetd端口转发：手动部署及踩坑小记</title>
<link>https://www.timelate.com/{category}/compiling-rinetd.html</link>
<guid isPermaLink="false">https://www.timelate.com/{category}/compiling-rinetd.html</guid>
<pubDate>Sun, 19 Dec 2021 11:00:00 +0800</pubDate>
<dc:creator>Lvv</dc:creator>
<category><![CDATA[笔记]]></category>
<category><![CDATA[rinetd]]></category>
<description><![CDATA[前段时间搞了几只国内的NAT鸡做中转，价格美丽但配置太垃。所以选择了用既能吃到BBR加速又轻量的rinetd作为端口转发。
起初直接apt install rinetd -y安装，后来发现其版本太旧了，并不支持UDP的转发，作罢。到其Github下载源码包...]]></description>
<content:encoded><![CDATA[
<!--markdown-->前段时间搞了几只国内的NAT鸡做中转，价格美丽但配置太垃。所以选择了用既能吃到BBR加速又轻量的rinetd作为端口转发。
<p>起初直接<code>apt install rinetd -y</code>安装，后来发现其版本太旧了，并不支持UDP的转发，作罢。到其Github下载源码包手动编译。编译过程很简单官方仓库也有说明，但有个小坑遂记录一下。</p>
<p>项目仓库：</p>
<blockquote>
<p><a href="https://github.com/samhocevar/rinetd">https://github.com/samhocevar/rinetd</a></p>
</blockquote>
<hr />
<h4>编译流程</h4>
<p>安装一些用到的依赖：</p>
<pre><code class="language-shell">apt install gcc make automake dos2unix -y</code></pre>
<p>下载包到本地并解压：</p>
<pre><code class="language-shell">wget https://github.com/samhocevar/rinetd/releases/download/v0.73/rinetd-0.73.tar.gz
tar -zvxf rinetd-0.73.tar.gz</code></pre>
<p>进入解压出来的文件夹：</p>
<pre><code class="language-shell">cd rinetd-0.73</code></pre>
<p>创建配置文件：</p>
<pre><code class="language-shell">./bootstrap</code></pre>
<p>就0.73这一版本而言，这一步肯定会报错：<strong>-bash: ./bootstrap: /bin/sh^M: bad interpreter: No such file or directory</strong>，这就是我前文提到的坑点。使用dos2unix将其转换格式：</p>
<pre><code class="language-shell">dos2unix bootstrap
//执行完会提示：dos2unix: converting file bootstrap to Unix format...</code></pre>
<p>dos2unix转换完后重新执行<code>./bootstrap</code></p>
<p><img src="https://img.timelate.com/i/2025/07/31/7fbed69fda0acd6db676d219476bce96.webp" alt="" /></p>
<p>完成后，创建构建文件：</p>
<pre><code class="language-shell">./configure</code></pre>
<p>开始安装：</p>
<pre><code class="language-shell">make &amp;&amp; make install</code></pre>
<p>安装很快几秒的事情，检查一下版本号：</p>
<pre><code class="language-shell">rinetd -v</code></pre>
<p>若为最新的0.73则安装完成。</p>
<p><img src="https://img.timelate.com/i/2025/07/31/a9909b16f05d9aa16840d0e742cc6bc0.webp" alt="" /></p>
<p>返回上层目录删除一下安装文件（强迫症）：</p>
<pre><code class="language-shell">cd ../
rm -rf rinetd*</code></pre>
<hr />
<h4>转发配置</h4>
<p>端口转发的配置文件在<strong>/usr/local/etc/rinetd.conf</strong></p>
<p>转发规则的写法也很好理解，配置文件插入新行，依次填入：</p>
<blockquote>
<p>本机监听地址 本地监听端口 转发目的地地址 转发目的地端口</p>
</blockquote>
<p>举个栗子：将本机的8080端口的TCP/UDP流量都转发到另一台IP为1.1.1.1鸡鸡的2333端口，如图。</p>
<p><img src="https://img.timelate.com/i/2025/07/31/cfb11aa619ef71dddf669bfce7830e65.webp" alt="" /></p>
<hr />
<h4>配置Systemd</h4>
<p>没啥好说的，配置一下systemd方便开机自启和管理：</p>
<pre><code class="language-shell">vim /etc/systemd/system/rinetd.service</code></pre>
<p>输入：</p>
<pre><code class="language-shell">[Unit]
Description=rinetd
After=network.target
[Service]
Type=forking
ExecStart=/usr/local/sbin/rinetd -c /usr/local/etc/rinetd.conf
[Install]
WantedBy=multi-user.target</code></pre>
<p>保存退出后：</p>
<pre><code class="language-shell">systemctl daemon-reload</code></pre>
<p>一些常用的管理命令：</p>
<pre><code class="language-shell">#启动rinetd
systemctl start rinetd
#设置开机启动
systemctl enable rinetd
#停止rinetd
systemctl stop rinetd
#重启rinetd
systemctl restart rinetd</code></pre>
]]></content:encoded>
<slash:comments>2</slash:comments>
<comments>https://www.timelate.com/{category}/compiling-rinetd.html#comments</comments>
</item>
<item>
<title>端口复用：实现80端口免流与建站共存</title>
<link>https://www.timelate.com/{category}/v2Ray-shares-port-80-with-Nginx.html</link>
<guid isPermaLink="false">https://www.timelate.com/{category}/v2Ray-shares-port-80-with-Nginx.html</guid>
<pubDate>Wed, 03 Nov 2021 02:17:00 +0800</pubDate>
<dc:creator>Lvv</dc:creator>
<category><![CDATA[笔记]]></category>
<category><![CDATA[nginx]]></category>
<category><![CDATA[v2ray]]></category>
<category><![CDATA[proxy]]></category>
<description><![CDATA[标题概括全文了，需求场景也很简单粗暴，v2Ray与Nginx共用80端口。主要解决：建站占用80口无法用于免流或免流占用80口不能建站的痛点。(~~我也不知道算不算痛点，可能对于小白玩家来说算吧？~~
这波啊，这波新瓶装旧酒了属于是：

"协议免流"- 据...]]></description>
<content:encoded><![CDATA[
<!--markdown-->标题概括全文了，需求场景也很简单粗暴，v2Ray与Nginx共用80端口。主要解决：建站占用80口无法用于免流或免流占用80口不能建站的痛点。(~~我也不知道算不算痛点，可能对于小白玩家来说算吧？~~
<p>这波啊，这波<strong>新瓶装旧酒</strong>了属于是：</p>
<blockquote>
<p><a href="https://www.timelate.com/lt-xyml.html">"协议免流"- 据说能免市面上所有的联通互联网套餐卡</a></p>
</blockquote>
<hr />
<h4>安装Nginx</h4>
<p>怎么方便怎么来，个人习惯宝塔面板：</p>
<blockquote>
<p><a href="https://www.bt.cn/">https://www.bt.cn/</a></p>
</blockquote>
<hr />
<h4>部署v2Ray</h4>
<p>因人而异，个人习惯用官方脚本，但配置起来相对麻烦。小白<del>或者比我更懒的</del>朋友可以使用x-ui面板，管理起来更方便。</p>
<h5>官方脚本</h5>
<p>详细步骤见之前的文章：[《"协议免流"- 据说能免市面上所有的联通卡》](<a href="https://www.timelate.com/Note/lt-xyml.html">https://www.timelate.com/Note/lt-xyml.html</a> "《"协议免流"- 据说能免市面上所有的联通卡》")，篇幅原因本文不再赘述，唯一不同的是<strong>配置请更改为以下：</strong></p>
<pre><code>{
  "inbounds": [
    {
      "port": 10000,
      "listen":"127.0.0.1",
      "protocol": "vmess",
      "settings": {
        "clients": [
          {
            "id": "输入你的UUID",
            "alterId": 0
          }
        ]
      },
      "streamSettings": {
        "network": "ws",
        "wsSettings": {
        "path": ""
        }
      }
    }
  ],
  "outbounds": [
    {
      "protocol": "freedom",
      "settings": {}
    }
  ]
}</code></pre>
<h5>x-ui管理面板</h5>
<blockquote>
<p><a href="https://github.com/vaxilu/x-ui" title="https://github.com/vaxilu/x-ui">https://github.com/vaxilu/x-ui</a></p>
</blockquote>
<p>一键安装：</p>
<pre><code>bash &lt;(curl -Ls https://raw.githubusercontent.com/vaxilu/x-ui/master/install.sh)</code></pre>
<p><strong><em>为保证服务器安全，安装完成后必须第一时间更改面板默认端口及登录信息！</em></strong>
<strong><em>为保证服务器安全，安装完成后必须第一时间更改面板默认端口及登录信息！</em></strong>
<strong><em>为保证服务器安全，安装完成后必须第一时间更改面板默认端口及登录信息！</em></strong></p>
<p>添加配置：监听IP更改为127.0.0.1，端口10000，uuid随机生成，传输协议ws</p>
<p><img src="https://img.timelate.com/i/2025/07/31/4f5f5fa3ac4dd7bdcdda82e30cec2e4d.webp" alt="" /></p>
<p>好了，到这v2ray这边的设置已经完事了，接下来配置Nginx。</p>
<hr />
<h4>配置Nginx</h4>
<p>宝塔随意添加一个站点，点开找到配置文件，键入：</p>
<pre><code>    location / {
    proxy_pass       http://127.0.0.1:10000;
    proxy_redirect             off;
    proxy_http_version         1.1;
    proxy_set_header Upgrade   $http_upgrade;
    proxy_set_header Connection "upgrade";
    proxy_set_header Host      $http_host;
    }</code></pre>
<p><img src="https://img.timelate.com/i/2025/07/31/df0471cd4995f0bfe4b5494d30e1e12f.webp" alt="" /></p>
<p>这段配置是实现Nginx和V2Ray共用端口的关键，配置中的10000端口也要与V2配置中的端口对应，来源HOSTLOC：</p>
<blockquote>
<p><a href="https://www.hostloc.com/thread-432082-1-1.html" title="https://www.hostloc.com/thread-432082-1-1.html">https://www.hostloc.com/thread-432082-1-1.html</a></p>
</blockquote>
<p>到这，v2Ray跟nginx共用80端口结构上算完成了，但没有完全完成。</p>
<hr />
<h4>添加（放行）免流HOST</h4>
<p>回到刚刚改过配置的站点，在域名管理处添加你需要的免流HOST：</p>
<p><img src="https://img.timelate.com/i/2025/07/31/ae43792bac59da0d8b7393f22661cfdd.webp" alt="" /></p>
<p>当然，也可以使用<strong>通配符</strong>：</p>
<p><img src="https://img.timelate.com/i/2025/07/31/091136817129d600f5be67388ddda440.webp" alt="" /></p>
<hr />
<h4>食用方法</h4>
<p>以Windows端客户端为例，懒得手机截图了，不同客户端间大同小异，举一反三吧：</p>
<p><img src="https://img.timelate.com/i/2025/07/31/8733305571b01a03c94dbafaa1c67dcd.webp" alt="" /></p>
<p><strong>代理模式选全局，若连接后能上网而查询IP为小鸡IP则成功。</strong></p>
]]></content:encoded>
<slash:comments>0</slash:comments>
<comments>https://www.timelate.com/{category}/v2Ray-shares-port-80-with-Nginx.html#comments</comments>
</item>
<item>
<title> LeaNote&amp;amp;WizNote:基于宝塔面板搭建私有云笔记</title>
<link>https://www.timelate.com/{category}/LeaNote-WziNote-quick-build.html</link>
<guid isPermaLink="false">https://www.timelate.com/{category}/LeaNote-WziNote-quick-build.html</guid>
<pubDate>Thu, 16 Jul 2020 00:11:00 +0800</pubDate>
<dc:creator>Lvv</dc:creator>
<category><![CDATA[笔记]]></category>
<category><![CDATA[leanote]]></category>
<category><![CDATA[wiznote]]></category>
<description><![CDATA[距离上次更博四个月后，我终于想起来自己还有一个博客...除除草吧，想了想也没有什么新“玩具”可以水的，那就记录一下曾经折腾过,现在也在用的私有化云笔记吧。
对于我来说云笔记毋庸置疑各种方面都能极大的方便工作和生活，能用好云笔记无疑是可以拥有第二大脑。云笔记...]]></description>
<content:encoded><![CDATA[
<!--markdown-->距离上次更博四个月后，我终于想起来自己还有一个博客...除除草吧，想了想也没有什么新“玩具”可以水的，那就记录一下曾经折腾过,现在也在用的私有化云笔记吧。
<p>对于我来说云笔记毋庸置疑各种方面都能极大的方便工作和生活，能用好云笔记无疑是可以拥有第二大脑。云笔记软件也是我平时使用频率最多之一了。</p>
<p>没啥好说的，近两年某些云服务厂商的骚操作让我们认识到了数据私有化的重要性。反正手头小鸡吃灰也是吃灰，不如跑点东西。</p>
<p>下面全文将记录LeaNote（蚂蚁笔记）和WizNote（为知笔记）使用宝塔面板环境搭建的整个详细流程，所以想折腾的话先把宝塔面板先装上吧：</p>
<pre><code>curl -sSO http://download.bt.cn/install/install_panel.sh &amp;&amp; bash install_panel.sh</code></pre>
<p><strong>我的折腾环境是CentOS7，流程仅供参考。</strong></p>
<p>先LeaNote后WizNote，正式使用个人更推荐搭建WizNote。</p>
<hr />
<h2>LeaNote</h2>
<p>1.先在宝塔的软件管理装个<strong>mangodb</strong>吧，这是LeaNote要用的数据库程序。</p>
<p><img src="https://img.timelate.com/i/2025/07/31/efb100b4944797b81885398965618948.webp" alt="" /></p>
<p>2.装完后添加一个数据库，供笔记程序使用。</p>
<p><img src="https://img.timelate.com/i/2025/07/31/315e6cd167c94e7fb8f689883ec3e7c5.webp" alt="" /></p>
<p>4.打开官方页面获取最新的二进制包下载地址，转战Shell：</p>
<blockquote>
<p><a href="http://leanote.org/#download" title="http://leanote.org/#download">http://leanote.org/#download</a></p>
</blockquote>
<pre><code>cd /home

wget https://nchc.dl.sourceforge.net/project/leanote-bin/2.6.1/leanote-linux-amd64-v2.6.1.bin.tar.gz</code></pre>
<p>5.解压下载包到当前目录：</p>
<pre><code>tar -xzvf leanote-linux-amd64-v2.6.1.bin.tar.gz</code></pre>
<p>6.将程序的数据导入mangodb库:</p>
<pre><code>mongorestore -h localhost -d leanote --dir /home/leanote/mongodb_backup/leanote_install_data
# leanote为开始创建的数据库名
# /home 为程序所在的目录
# 举一反三自行更改</code></pre>
<p><img src="https://img.timelate.com/i/2025/07/31/2c6d01f8b1e49b77ffd33d8c9e8ccab9.webp" alt="" /></p>
<p>7.修改leanote配置文件(宝塔后台文件管理编辑更方便)：</p>
<pre><code>vim /home/leanote/conf/app.conf</code></pre>
<p>按需求改几个地方：</p>
<pre><code>http.addr=0.0.0.0 # 建议本地化改成 127.0.0.1
http.port=9000 # 服务端口

site.url=http://localhost:9000 # 网站地址 举个栗子可填：https://xxx.xxx.com

# admin username
adminUsername=admin # 这里是指定管理员账户，按需改成用户名

# You Must Change It !! About Security!!
app.secret=V85ZzBeTnzpsHyjQX4zukbQ8qqtju9y2aDM55VWxAH9Qop19poekx3xkcDVvrD0y # 务必修改该项，否则有安全隐患。密匙共64字符，随机更改几个即可。</code></pre>
<p>8.试运行程序，看看功能是否正常：</p>
<pre><code>cd /home/leanote/bin
bash run.sh</code></pre>
<p>如图则为成功运行（curl <a href="http://127.0.0.1:9000">http://127.0.0.1:9000</a> 有html输出）：</p>
<p><img src="https://img.timelate.com/i/2025/07/31/f192d8acb113fa6a55a41fb0d8251462.webp" alt="" /></p>
<p><img src="https://img.timelate.com/i/2025/07/31/660b3a0b3a5bad47cca6af142e6d9822.webp" alt="" /></p>
<p>9.试运行正常后Ctrl+C结束，用nohup后台运行程序：</p>
<pre><code># 运行服务命令：
nohup /bin/bash /home/leanote/bin/run.sh &gt;&gt; /var/log/leanote.log 2&gt;&amp;1 &amp;
# 停止服务命令：
jobnum=`jobs | grep "revel run github.com/leanote/leanote" | awk -F"]" '{print $1}'|awk -F"[" '{print $2}'`;kill %$jobnum</code></pre>
<p>10.宝塔面板新建一个站点，并开启反代：</p>
<p><img src="https://img.timelate.com/i/2025/07/31/c33d96c84b4688d7d875eae998a47c07.webp" alt="" /></p>
<p><img src="https://img.timelate.com/i/2025/07/31/df0d99581266f5dace318d88dd3d6c20.webp" alt="" /></p>
<p>11.随手开启SSL（个人习惯，开不开无所谓），便大功告成了，访问添加了反代的域名即可使用。</p>
<p><img src="https://img.timelate.com/i/2025/07/31/03d363688b2f9c76bcaf161b88737d74.webp" alt="" /></p>
<p><img src="https://img.timelate.com/i/2025/07/31/fbb092dce171b82d663b237036db4dc8.webp" alt="" /></p>
<p><strong>PS：程序默认管理员账户：admin 密码：abc123，另还附带一个是演示账户：demo@leanote.com 密码：demo@leanote.com 自行在后台删改。</strong></p>
<p>简单说一下LeaNote吧，源码最后一次更新在<strong>2018年</strong>，很久没有维护了，网上风评也是bug很多。各平台客户端可以在官网下载：</p>
<blockquote>
<p><a href="https://leanote.com/index#" title="https://leanote.com/index#">https://leanote.com/index#</a></p>
</blockquote>
<p>客户端也很久没有更新了。总体来说该程序生态处于“要什么自行车”阶段，也不是不能用。</p>
<hr />
<h2>WizNote</h2>
<p>1.到宝塔面板的软件商店安装<strong>Docker管理器</strong></p>
<p><img src="https://img.timelate.com/i/2025/07/31/58e9c551191a11d82dbb9a608b432c3b.webp" alt="" /></p>
<p>2.配置阿里云容器镜像加速，加速拉取官方镜像（<strong>非国内VPS可以跳过</strong>）</p>
<p>打开 <a href="https://cr.console.aliyun.com/cn-hangzhou/instances/mirrors" title="阿里云容器镜像服务">阿里云容器镜像服务</a>，左侧菜单找到镜像加速器，按文档配置：</p>
<p><img src="https://img.timelate.com/i/2025/07/31/e3170c169ef35e81b2332a22ded7e5be.webp" alt="" /></p>
<pre><code>sudo mkdir -p /etc/docker
sudo tee /etc/docker/daemon.json &lt;&lt;-'EOF'
{
  "registry-mirrors": ["https://xxxx.mirror.aliyuncs.com"]
}
EOF
sudo systemctl daemon-reload
sudo systemctl restart docker</code></pre>
<p>3.创建一个文件夹用于储存服务端数据：</p>
<pre><code>mkdir /home/wiz-data
# 个人习惯放/home,自行更改</code></pre>
<p>4.打开面板的Docker管理器，输入<strong>wiznote/wizserver</strong>获取WizNote官方镜像：</p>
<p><img src="https://img.timelate.com/i/2025/07/31/684e1b993548a709f3f29c9130bb35b8.webp" alt="" /></p>
<p>该镜像1.6G，请耐心等待拉取完成。</p>
<p>5.镜像拉取完成后，在容器列表创建一个新容器，镜像选择<strong>wiznote/wizserver:latest</strong>，参考下图填写<strong>端口映射</strong>与<strong>目录映射</strong>，<strong>内存配额建议给1G+</strong>，不然<strong>太小跑不动</strong>。</p>
<p><img src="https://img.timelate.com/i/2025/07/31/79ce4127368ce6696cc4601778c50557.webp" alt="" /></p>
<p>6.填写完成后，提交创建容器，随手改个名称便于后期管理：</p>
<p><img src="https://img.timelate.com/i/2025/07/31/36b0d4cc101c26e87bdca76638259170.webp" alt="" /></p>
<p>7.第一次启动镜像大概需要2-3分钟时间，curl一下确认是否成功运行：</p>
<pre><code>curl http://127.0.0.1:6666</code></pre>
<p>提示<strong>You need to enable JavaScript to run this app.</strong>则成功运行。</p>
<p><img src="https://img.timelate.com/i/2025/07/31/dc30119f8d70200cc45b1529871aea8a.webp" alt="" /></p>
<p>8.老样子宝塔添加一个站点直接开启反代：</p>
<p><img src="https://img.timelate.com/i/2025/07/31/4f8d111134e96f90233afdeede5c87da.webp" alt="" /></p>
<p>9.开启SSL（个人习惯），据官方文档需要修改下反代配置：</p>
<pre><code># 将宝塔反代配置文件的proxy_set_header全部替换:
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header x-wiz-real-ip $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
proxy_set_header X-Forwarded-Proto $scheme;</code></pre>
<p><img src="https://img.timelate.com/i/2025/07/31/6225013b41117d522ffab0bb7446a02c.webp" alt="" /></p>
<p>测试一下https是否生效，在浏览器内输入：</p>
<pre><code>https://your-server/?p=wiz&amp;c=endpoints
# 注意是https协议，将your-server修改成自己的域名</code></pre>
<p>正常情况下，会返回一个json数据，检查第一个key wizas的值，应该是https开头。如果是http开头，则说明配置没有生效。</p>
<p><img src="https://img.timelate.com/i/2025/07/31/f6f4e72f26070d435d3dbff86ccbdafb.webp" alt="" /></p>
<p>大功告成。直接访问反代的域名即可使用：</p>
<p><img src="https://img.timelate.com/i/2025/07/31/0d742b99934b7d1defd992a3bbd11523.webp" alt="" /></p>
<p>默认管理员账号：admin@wiz.cn，密码：123456。请在部署完成后，使用这个账号，登录网页版，然后修改管理员密码。其他用户，请自行注册。免费版本可以注册5个用户（不包含管理员账号）</p>
<p><strong>参考文档：<a href="https://www.wiz.cn/zh-cn/docker" title="https://www.wiz.cn/zh-cn/docker">https://www.wiz.cn/zh-cn/docker</a></strong></p>
<hr />
<h2>后话</h2>
<p>相对于LeaNote,WizNote更香。有团队持续维护，有各个平台客户端，有着更美观的界面，有着更符合国人的操作习惯,数据可以托管到几个阿里腾讯等大厂的云储存。最重要的是可以免费白嫖所有功能啊！啧啧啧~</p>
]]></content:encoded>
<slash:comments>3</slash:comments>
<comments>https://www.timelate.com/{category}/LeaNote-WziNote-quick-build.html#comments</comments>
</item>
<item>
<title>私有云盘搭建 - Cloudreve3.0尝鲜折腾小记</title>
<link>https://www.timelate.com/{category}/cloudreve3-0-install.html</link>
<guid isPermaLink="false">https://www.timelate.com/{category}/cloudreve3-0-install.html</guid>
<pubDate>Fri, 13 Mar 2020 17:37:00 +0800</pubDate>
<dc:creator>Lvv</dc:creator>
<category><![CDATA[笔记]]></category>
<category><![CDATA[cloudreve]]></category>
<description><![CDATA[Cloudreve无疑是我搭建私有云盘的首选，在去年的时候作者便说重构版本，并在新年前更新（大大的flag
就在下午我摸鱼的时候，发现作者咕咕咕了这么久终于悄无声息的更了，还是个Beta2版本。闲着也是闲着，尝下鲜吧，顺便记录一下过程。


Github：...]]></description>
<content:encoded><![CDATA[
<!--markdown-->Cloudreve无疑是我搭建私有云盘的首选，在去年的时候作者便说重构版本，并在新年前更新（大大的flag
<p>就在下午<del>我摸鱼的时候</del>，发现作者咕咕咕了这么久终于悄无声息的更了，还是个Beta2版本。闲着也是闲着，尝下鲜吧，顺便记录一下过程。</p>
<hr />
<blockquote>
<p>Github：<a href="https://github.com/cloudreve/Cloudreve" title="https://github.com/cloudreve/Cloudreve">https://github.com/cloudreve/Cloudreve</a></p>
</blockquote>
<blockquote>
<p>官方文档：<a href="https://docs.cloudreve.org/" title="https://docs.cloudreve.org/">https://docs.cloudreve.org/</a></p>
</blockquote>
<hr />
<p><strong>部署环境：CentOS 7.7/Nginx 1.17.9/MySQL 5.5.62</strong></p>
<p>1.<a href="https://github.com/cloudreve/Cloudreve/releases" title="Releases">Releases</a>下载程序到本地：</p>
<pre><code>wget https://github.com/cloudreve/Cloudreve/releases/download/3.0.0-beta2/cloudreve_3.0.0-beta2_linux_amd64.tar.gz</code></pre>
<p>2.在/home目录新建一个程序文件夹，方便日后文件管理：</p>
<pre><code>mkdir /home/cloudreve</code></pre>
<p>3.将下载的程序解压到/home/cloudreve目录</p>
<pre><code>tar -C /home/cloudreve -xzf cloudreve_3.0.0-beta2_linux_amd64.tar.gz</code></pre>
<p>4.进入程序目录赋予执行权限，并启动</p>
<pre><code># 进入程序目录
cd /home/cloudreve
# 赋予执行权限
chmod +x ./cloudreve
 # 启动 Cloudreve
./cloudreve</code></pre>
<p>5.不出意外的话会跳出程序初始化界面，记得保存账号密码。</p>
<p><img src="https://img.timelate.com/i/2025/07/31/dbbfe6764bb8be9f7ebb36d3a066e000.webp" alt="" /></p>
<p>6.放行5212端口（我是宝塔，后台添加放行端口即可)。访问http:// ip:5212 看看程序是否正常开启，同时Shell也会跑出记录。</p>
<p><img src="https://img.timelate.com/i/2025/07/31/ce2ffae86d460ce21bcf8d23f362feb0.webp" alt="" /></p>
<p><img src="https://img.timelate.com/i/2025/07/31/c5269d37e15d83e4401808d65bc3db8b.webp" alt="" /></p>
<p>7.确认无误后，Shell面板Ctrl+C结束程序运行,配置Systemd进程守护。</p>
<pre><code># 新建并编辑配置文件
vim /usr/lib/systemd/system/cloudreve.service</code></pre>
<p>8.根据实际情况填写以下内容并保存：</p>
<pre><code>[Unit]
Description=Cloudreve
Documentation=https://docs.cloudreve.org
After=network.target
Wants=network.target
After=mysqld.service

[Service]
WorkingDirectory=/home/cloudreve
ExecStart=/home/cloudreve/cloudreve
Restart=on-abnormal
RestartSec=5s
KillMode=mixed

StandardOutput=null
StandardError=syslog

[Install]
WantedBy=multi-user.target
</code></pre>
<p>其中以下配置项需要根据实际情况更改：</p>
<ul>
<li><strong>WorkingDirectory</strong> 主程序所在目录</li>
<li><strong>ExecStart</strong> 主程序绝对路径</li>
</ul>
<p><img src="https://img.timelate.com/i/2025/07/31/e55ae4670a99b49256802e3c1c46358f.webp" alt="" /></p>
<p>9.完成后更新配置，设置程序开机自启：</p>
<pre><code># 更新配置
systemctl daemon-reload

# 设置开机启动
systemctl enable cloudreve</code></pre>
<p>日后你可以通过以下指令管理 Cloudreve 进程：</p>
<pre><code># 启动服务
systemctl start cloudreve

# 停止服务
systemctl stop cloudreve

# 重启服务
systemctl restart cloudreve

# 查看状态
systemctl status cloudreve</code></pre>
<p>10.最后Nginx反代一波，宝塔添加一个站点，解析好域名,站点修改添加反向代理:</p>
<p><img src="https://img.timelate.com/i/2025/07/31/5a9ec6fea6b228527bc62b5b61c755e8.webp" alt="" /></p>
<p>添加完反代后便可以通过自己的域名访问了，程序的部署到这里也算基本完成了。</p>
<hr />
<p>接下来进行一些小调整，Cloudreve默认数据库内置的SQLite，个人还是喜欢Mysql。</p>
<p><strong>Tips:更换数据库配置后，Cloudreve 会重新初始化数据库，原有的数据将会丢失。</strong></p>
<p>宝塔创建一个数据库，然后编辑Cloudreve的配置文件：</p>
<pre><code>vim /home/cloudreve/conf.ini</code></pre>
<p>添加以下配置：</p>
<pre><code>[Database]
; 数据库类型，目前支持 sqlite | mysql
Type = mysql
; 用户名
User = root
; 密码
Password = root
; 数据库地址
Host = 127.0.0.1
; 数据库名称
Name = v3
; 数据表前缀
TablePrefix = cd</code></pre>
<p><img src="https://img.timelate.com/i/2025/07/31/074c240d6dd9f2f68eccd30828d99048.webp" alt="" /></p>
<p>保存后，进程序目录重新初始化，生成新的账号密码，之后再用systemctl管理，完事了。</p>
<pre><code>#进程序目录
cd /home/cloudreve
#启动程序
./cloudreve</code></pre>
<p>另外提一嘴，程序默认监听端口也是在该文件修改。</p>
<hr />
<p><strong>更多安装方式和程序配置添加详见官方文档</strong>（作者文档也咕了不少：</p>
<blockquote>
<p><a href="https://docs.cloudreve.org/getting-started/config" title="https://docs.cloudreve.org/getting-started/config">https://docs.cloudreve.org/getting-started/config</a></p>
</blockquote>
]]></content:encoded>
<slash:comments>13</slash:comments>
<comments>https://www.timelate.com/{category}/cloudreve3-0-install.html#comments</comments>
</item>
<item>
<title>TCShare - 天翼云API目录列表程序折腾小记</title>
<link>https://www.timelate.com/{category}/tcshare-log.html</link>
<guid isPermaLink="false">https://www.timelate.com/{category}/tcshare-log.html</guid>
<pubDate>Wed, 12 Feb 2020 21:50:00 +0800</pubDate>
<dc:creator>Lvv</dc:creator>
<category><![CDATA[笔记]]></category>
<category><![CDATA[tcshare]]></category>
<description><![CDATA[***2020/5/23***
万人骑的API: safebox 凉了，用该API会无法授权，请自行寻找更换新的API。

好久不见，又到了懒癌晚期博主随缘更新环节。为什么会诈尸更新，这要从一只蝙蝠说起...
最近上网冲浪的时候，在Loc发现了TCShar...]]></description>
<content:encoded><![CDATA[
<!--markdown-->***2020/5/23***
<p>万人骑的API: safebox 凉了，用该API会无法授权，请自行寻找更换新的API。</p>
<hr />
<p>好久不见，又到了懒癌晚期博主随缘更新环节。为什么会诈尸更新，这要从一只蝙蝠说起...</p>
<p>最近上网冲浪的时候，在Loc发现了TCShare这个天翼云列目录程序，恰好最近疫情影响人闲得慌，又恰好手里10T的天翼云盘也闲得慌，于是<del>拖延到</del>抽空在今天<del>才</del>就折腾了一下。</p>
<hr />
<blockquote>
<p>程序开源地址：<a href="https://github.com/xytoki/TCShare" title="https://github.com/xytoki/TCShare">https://github.com/xytoki/TCShare</a></p>
</blockquote>
<blockquote>
<p>Hostloc原帖：<a href="https://hostloc.com/thread-640211-1-1.html" title="https://hostloc.com/thread-640211-1-1.html">https://hostloc.com/thread-640211-1-1.html</a></p>
</blockquote>
<hr />
<p><strong>2020/4/25 懒癌晚期的我终于回来更新一下V3版本的安装流程了...</strong>
<strong>本文折腾环境基于:宝塔面板/Nginx1.17.8/PHP7.3</strong>
食用方式：</p>
<p>1.新建站点，找到配置文件把以下代码注释掉，解决列网盘图片404的问题：</p>
<pre><code>        #location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$
        #{
        #    expires      30d;
        #    error_log off;
        #    access_log off;
        #}</code></pre>
<p>图示：
<img src="https://img.timelate.com/i/2025/07/31/6e3c669c2f57efb13c04919a445d1f6c.webp" alt="" /></p>
<p>2.找到伪静态，设置Rewrite规则：</p>
<pre><code>try_files $uri $uri/ /index.php$is_args$args;
location ~ /\.env {
    deny all;
}</code></pre>
<p>图示：
<img src="https://img.timelate.com/i/2025/07/31/882cb221c34518c41bae662d4310a998.webp" alt="" /></p>
<p>3.到PHP设置找到禁用函数，移除<strong>putenv</strong>，便于后续用composer安装依赖。</p>
<p><img src="https://img.timelate.com/i/2025/07/31/a061b3f85b9515ffb9612dbd3eb84b64.webp" alt="" /></p>
<p>4.从GitHub拉程序下来扔在网站目录，<a href="https://github.com/gonewind73/scrapy/blob/9a18248c9cfa5020d4124a4b7c4d579b2ed70b34/cloud189Disk.py" title="获取API">获取API</a>，在网站根目录新建一个名为<strong>.env</strong>的文件，复制以下模板键入：</p>
<pre><code>#   XS 是前缀
#   | -KEY 是配置种类，可选KEY，APP，SEC
#   | | - -ct是key的ID（类似config.php）
#   | | - | - something是配置名称
#   | | - | - | - - - - value在等号右边
#   XS_KEY_ct_something=value

    XS_KEY_ct=ctyun   #必填，值为ctyun
    XS_KEY_ct_FD=     #应用文件夹名
    XS_KEY_ct_AK=     #AK
    XS_KEY_ct_SK=     #SK

#   这里APP后面的可以是任意值，一般就123456下去
#          ↓
    XS_APP_1=/              #挂载路径
    XS_APP_1_NAME=RuaDisk   #网盘名称
    XS_APP_1_THEME=mdui     #界面主题
    XS_APP_1_BASE=/         #网盘内路径
    XS_APP_1_KEY=ct         #对应上面Key的ID</code></pre>
<p><strong>如图，根据API填写应用文件夹名，AK，SK对应值。</strong></p>
<p><img src="https://img.timelate.com/i/2025/07/31/8e23cf448e6031068d4cc5ac0089a503.webp" alt="" /></p>
<p>5.转战Shell终端，进入网站根目录，<strong>composer install</strong>安装依赖。</p>
<pre><code>#命令以rua.cx为例，请自行替换自己的网站根目录。
cd /www/wwwroot/rua.cx
composer install</code></pre>
<p>图示：</p>
<p><img src="https://img.timelate.com/i/2025/07/31/005263ad3d3b10f389250b6211c6df48.webp" alt="" /></p>
<p><strong>如安装失败（见配图），请确认网站PHP所用的版本以移除putenv函数的禁用。并在shell终端下执行以下命令将宝塔php版本设置为系统php-cli版本</strong></p>
<p><img src="https://img.timelate.com/i/2025/07/31/ccc7b01126cf3924ad5576b98c7f9fba.webp" alt="" /></p>
<pre><code>ln -sf /www/server/php/73/bin/php /usr/bin/php</code></pre>
<p>根据自己宝塔安装的PHP版本更改，不要照抄，我的版本是PHP7.3所以这里是/php/73，你如果是PHP7.2的话就是/php/72，以此类推举一反三。更改后再次执行composer install即可。</p>
<p>6.依赖安装完成后，直接访问站点域名，不出意外的话就可以看到安装界面了，直接点击<strong>Click here to authorize</strong>进入授权界面。</p>
<p><img src="https://img.timelate.com/i/2025/07/31/00d8cfc623e6f98b33e5bb8af0281192.webp" alt="" /></p>
<p>7.输入天翼云盘的账号密码后会自动跳转到网站首页，安装算是完了。</p>
<p><img src="https://img.timelate.com/i/2025/07/31/4dbac02a8fdc6622797baa120d768403.webp" alt="" /></p>
<p>8.最后来到我们的天翼云盘，在<strong>我的应用</strong>中新建一个<strong>safebox</strong>的文件夹。</p>
<p><img src="https://img.timelate.com/i/2025/07/31/f9525359e35e2d7f971b0d27a698fc78.webp" alt="" /></p>
<p><strong>PS：safebox文件夹为API指定，无法更改名字。需要列目录的文件也是往里面扔，网页端才会显示。</strong></p>
<p>9.每个月记得要手动访问定时访问 <strong>/-renew</strong> ，更新授权，以延长token的有效期。</p>
<p><img src="https://img.timelate.com/i/2025/07/31/be57b362073c42543a7feb38f089f8eb.webp" alt="" /></p>
<p>然后就完事了，站点标题、主题等也是在网站根目录<strong>.env</strong>文件修改，作者都有注释。</p>
<hr />
<p>因为基于天翼云盘，国内下载速度直接跑满宽带，比Onedrive香多了。</p>
<p>最大的坑就是天翼云普通会员每日上传文件总大小限制<strong>2G</strong>,开会员可解...</p>
]]></content:encoded>
<slash:comments>33</slash:comments>
<comments>https://www.timelate.com/{category}/tcshare-log.html#comments</comments>
</item>
<item>
<title>&amp;quot;协议免流&amp;quot;- 据说能免市面上所有的联通互联网套餐卡</title>
<link>https://www.timelate.com/{category}/lt-xyml.html</link>
<guid isPermaLink="false">https://www.timelate.com/{category}/lt-xyml.html</guid>
<pubDate>Sun, 02 Jun 2019 23:14:00 +0800</pubDate>
<dc:creator>Lvv</dc:creator>
<category><![CDATA[笔记]]></category>
<category><![CDATA[nginx]]></category>
<category><![CDATA[v2ray]]></category>
<category><![CDATA[proxy]]></category>
<description><![CDATA[前不久妖火一大佬发出了一篇名为“开辟免流新时代的帖子”，帖子中描述了与传统混淆免流不同的姿势，该大佬称其为“协议免流”并宣称无需免流HOST便可实现全免。随后又发出了一张描述模糊的截图陈述了实现方法：Nginx+V2Ray（WS）+CDN（鹅厂）。
这一帖...]]></description>
<content:encoded><![CDATA[
<!--markdown-->前不久妖火一大佬发出了一篇名为“开辟免流新时代的帖子”，帖子中描述了与传统混淆免流不同的姿势，该大佬称其为“协议免流”并宣称无需免流HOST便可实现全免。随后又发出了一张描述模糊的截图陈述了实现方法：Nginx+V2Ray（WS）+CDN（鹅厂）。
<p>这一帖子发出后，便引起了坛友的不小的讨论。但之后便不了了之了。因为帖子描述的过于模糊，用论坛里的话来说就是除了作者之外没有第二个人能用这个方法免。使得这一大佬沦为坛子里的笑谈。</p>
<hr />
<p>直到上个月二十多号（记不清了，懒得翻帖子），该大佬再次发出帖子放出了该免流方式的实现方法以及Docker一键脚本。</p>
<p>体验了一下，该方式最大的优势不再像传统的55R混淆免流一样占用小鸡的80端口，终于可以在跑网站的小鸡上同时跑免流了，<del>呃..还能合理用掉每个月免费60G鹅厂CDN。</del></p>
<p>简单记录一下我的搭建流程吧。</p>
<hr />
<p>我的安装环境是CentOS7，Nginx版本是1.16。</p>
<p><strong>备案劝退：需要一个备案的域名才能实现免流，因为鹅厂的CDN才是免流的关键！！！</strong></p>
<h4>安装Nginx</h4>
<p>因为我的初衷就是在跑网站的同时能跑免流，所以个人习惯还是BT面板(呃..官方渠道,nginx版本随意)：</p>
<blockquote>
<p><a href="https://www.bt.cn/">https://www.bt.cn/</a></p>
</blockquote>
<h4>安装V2Ray</h4>
<p>也偷懒，直接官方一键脚本：</p>
<pre><code>bash &lt;(curl -L https://raw.githubusercontent.com/v2fly/fhs-install-v2ray/master/install-release.sh)</code></pre>
<p>设置开机自启：</p>
<pre><code>systemctl enable v2ray</code></pre>
<h4>配置V2Ray</h4>
<p>清空VtwoRay配置文件内容：</p>
<pre><code>echo "" &gt; /usr/local/etc/v2ray/config.json</code></pre>
<p>重新编辑配置文件：</p>
<pre><code>vi /usr/local/etc/v2ray/config.json</code></pre>
<p>键入以下内容：</p>
<pre><code>{
  "inbounds": [
    {
      "port": 10000,
      "listen":"127.0.0.1",
      "protocol": "vmess",
      "settings": {
        "clients": [
          {
            "id": "自建一个UUID",
            "alterId": 0
          }
        ]
      },
      "streamSettings": {
        "network": "ws",
        "wsSettings": {
        "path": "/ray"
        }
      }
    }
  ],
  "outbounds": [
    {
      "protocol": "freedom",
      "settings": {}
    }
  ]
}</code></pre>
<p><strong>配置中的UUID请自行生成：<a href="https://www.uuidgenerator.net/" title="https://www.uuidgenerator.net/">https://www.uuidgenerator.net/</a></strong></p>
<h4>配置Nginx</h4>
<p>BT面板直接新建一个站点，配置好SSL，点开找到配置文件，键入：</p>
<pre><code>    location /ray {
    proxy_pass       http://127.0.0.1:10000;
    proxy_redirect             off;
    proxy_http_version         1.1;
    proxy_set_header Upgrade   $http_upgrade;
    proxy_set_header Connection "upgrade";
    proxy_set_header Host      $http_host;
    }
}</code></pre>
<p>DEMO:</p>
<p><img src="https://img.timelate.com/i/2025/07/31/accb8a495920de4b8b0fd9ff423c7d1c.webp" alt="" /></p>
<p>这段是实现Nginx和V2Ray共用端口的关键，配置中的10000端口也要与V2配置中的端口对应，来源HOSTLOC：</p>
<blockquote>
<p><a href="https://www.hostloc.com/thread-432082-1-1.html" title="https://www.hostloc.com/thread-432082-1-1.html">https://www.hostloc.com/thread-432082-1-1.html</a></p>
</blockquote>
<h4>套上鹅厂CDN（免流关键）</h4>
<p>没什么好说的，配置好SSL，直接套就完事了：</p>
<p><img src="https://img.timelate.com/i/2025/07/31/a6f3d8baa1e2593d297cc0dc8ab1571e.webp" alt="" /></p>
<h4>启动V2Ray</h4>
<pre><code>systemctl start v2ray</code></pre>
<p>用一下命令查看VtwoRay是否运行：</p>
<pre><code>systemctl status v2ray</code></pre>
<p>若成功运行会显示如下字样：</p>
<p><img src="https://img.timelate.com/i/2025/07/31/f27f7a29fb39290fb68a5516a42277d3.webp" alt="" /></p>
<p>呃...保险起见BT后台也重启一下Nginx让其配置生效。</p>
<p><strong>搭建流程END</strong></p>
<hr />
<h4>食用方式（IOS）：</h4>
<p>手头没有android设备...IOS端我用的APP是Quan:</p>
<p><img src="https://img.timelate.com/i/2025/07/31/c8badaa4486d16b764eac2610c310ed2.webp" alt="" /></p>
<p>代理模式选全局，若连接后能上网而查询IP为小鸡IP则成功。</p>
<hr />
<h4>后记</h4>
<p>经过我十多天的测试，确实免流体验比55R混淆好（可以打王者，55R混淆并不能），跳点也蛮低的，但不知道什么免流原理，必须要套鹅厂的CDN才能免，我测试了不套CDN被正常扣流量，疑似BUG。</p>
<p>掌厅查上网记录,记录中打码部分为我的域名，并不是免流的Host，但是走的却是免费流量。呃...也算一张不严谨的跳点测试图，有部分消耗的是我裸连用的。上个月粗略测试了一下大概300M跳0.03M吧，并没有存图。</p>
<p><img src="https://img.timelate.com/i/2025/07/31/03732acdb0ca2663e9d9abe2683de92b.webp" alt="" /></p>
<p><strong>据妖火的一位坛友测试，40G解除封顶限制后该方法失去免流效果。</strong></p>
<p>就这样了，最后说一句，懒癌+拖延症真可怕~</p>
<p><img src="https://img.timelate.com/i/2025/07/31/f1ed7aee65e21c620b8205099e622a86.webp" alt="" /></p>
]]></content:encoded>
<slash:comments>17</slash:comments>
<comments>https://www.timelate.com/{category}/lt-xyml.html#comments</comments>
</item>
<item>
<title>云探针 - ServerStatus的生产与护理</title>
<link>https://www.timelate.com/{category}/ServerStatus.html</link>
<guid isPermaLink="false">https://www.timelate.com/{category}/ServerStatus.html</guid>
<pubDate>Sat, 28 Apr 2018 14:10:00 +0800</pubDate>
<dc:creator>Lvv</dc:creator>
<category><![CDATA[笔记]]></category>
<category><![CDATA[serverstatus]]></category>
<description><![CDATA[首先在文章的开头，我要向你介绍一遍ServerStatus是什么。对没错我就是不管你知不知道ServerStatus是什么也要假装你不知道ServerStatus是什么的样子介绍一遍。

难得水个文，凑字数容易嘛我
ServerStatus是个云探针。顾名...]]></description>
<content:encoded><![CDATA[
<!--markdown-->首先在文章的开头，我要向你介绍一遍ServerStatus是什么。对没错我就是不管你知不知道ServerStatus是什么也要假装你不知道ServerStatus是什么的样子介绍一遍。
<!--more-->
<p><del>难得水个文，凑字数容易嘛我</del></p>
<p>ServerStatus是个云探针。顾名思义它可以把你的多显示在一个公共的HTML页面上，这些基本信息包括但不限于：系统在线时间、当前负载情况、实时网络速率、服务器至开机使用的总流量、CPU实时使用率、内存实时使用率、硬盘实时使用率等。</p>
<p>虽然我的小鸡不多，但是我也有挂探针的习惯，因为可以<del>显得好高大上啊</del>咳咳。之前一直都都是用逗比大佬的<a href="https://doub.io/shell-jc3/" title="ServerStatus一键脚本">ServerStatus一键脚本</a>，整合了服务端客户端的配置，前端展示界面也更美观。但是最近我在配置一台小鸡的时候发现，貌似一键脚本的服务端配置在Debian8环境下和宝塔面板有iptables冲突，会导致机器连接不上，emmm或许只是个例吧。</p>
<p>后来就把手里的机器换回了手动配置的<a href="https://github.com/cppla/ServerStatus" title="ServerStatus中文版">ServerStatus中文版</a>，所以本文为个人配置记录，以防健忘~</p>
<hr />
<h3>环境配置</h3>
<p>安装screen：</p>
<pre><code>    #CentOS
    yum install -y screen

    #Debian
    apt-get install -y screen</code></pre>
<p>安装Git：</p>
<pre><code>    #CentOS
    yum install -y git-core

    #Debian
    apt-get install -y git</code></pre>
<p>克隆ServerStatus项目到本地：</p>
<pre><code>    git clone https://github.com/tenyue/ServerStatus.git</code></pre>
<h3>服务端配置</h3>
<p>首先宝塔、oneinstack等程序走一波，配置一个HTTP服务：lnmp、lamp什么鬼的都行。</p>
<p>安装ServerStatus：</p>
<pre><code>    cd ServerStatus/server
    make</code></pre>
<p>程序运行测试：</p>
<pre><code>    ./sergate</code></pre>
<p>没有错误提示如下图就OJBK，CTRL+C结束测试；如果有错误提示，自行放行35601端口，或者关闭防火墙。</p>
<p><img src="https://img.timelate.com/i/2025/07/31/dd72cfc4de7f93ee924ef35bb4b311d1.webp" alt="" /></p>
<p>编辑服务端的配置文件：</p>
<pre><code>    vi config.json</code></pre>
<p>参考以下注释修改：</p>
<pre><code>                    {
                            "username": "s01", #客户端连接名，相当于登陆账号
                            "name": "node1",  #hmtl显示的主机名
                            "type": "xen",  #机器的虚拟方式，如：Xen、KVM、OpenVZ
                            "host": "host1",  #机器的名字，随意写
                            "location": "cn",  #机器的物理位置
                            "password": "USER_DEFAULT_PASSWORD"  #客户端连接密码，相当于登录密码
                    },</code></pre>
<p>复制ServerStatus的WEB目录到网站目录：</p>
<pre><code>    cd /root

    #/www/wwwroot/status HTTP站点的绝对路径，自行修改
    cp -r ServerStatus/web/* /www/wwwroot/status</code></pre>
<p>将ServerStatus放在后台运行：</p>
<pre><code>    cd ServerStatus/server

    #同上修改/www/wwwroot/status为HTTP站点的绝对路径
    screen -dmS web ./sergate --config=config.json --web-dir=/www/wwwroot/status</code></pre>
<p><strong><em>添加新的监控机器</em></strong>
编辑服务端配置：</p>
<pre><code>    vi config.json</code></pre>
<p>添加新的机器信息，然后重启sergate
查看sergate运行的进程ID：</p>
<pre><code>    ps -ef | grep web</code></pre>
<p>如图，我的进程ID是9116、9117</p>
<p><img src="https://img.timelate.com/i/2025/07/31/f1cd7fbc936bc9056aeeab172f1332e7.webp" alt="" /></p>
<p>将进程kill掉：</p>
<pre><code>    kill -9 9116
    kill -9 9117</code></pre>
<p>然后重新运行sergate：</p>
<pre><code>    screen -dmS web ./sergate --config=config.json --web-dir=/www/wwwroot/status</code></pre>
<h3>客户端配置</h3>
<p>在已经安装了ServerStatus的前提下，也就是：</p>
<pre><code>    git clone https://github.com/tenyue/ServerStatus.git
    cd ServerStatus/server
    make</code></pre>
<p>再进行操作：</p>
<pre><code>    cd ServerStatus/clients
    vi client-linux.py</code></pre>
<p>修改配置文件：</p>
<pre><code>    SERVER = "127.0.0.1"  #服务端的ip或域名
    PORT = 35601  #连接端口，一般默认
    USER = "s01"  #连接用户名，相当于登陆账号
    PASSWORD = "USER_DEFAULT_PASSWORD"  #连接密码，相当于登陆密码
    INTERVAL = 1 #更新间隔</code></pre>
<p>修改完后，运行ServerStatus客户端（后台运行需要先安装screen）：</p>
<pre><code>    #前台运行
    python client-linux.py

    #后台运行
    screen -dmS jp python client-linux.py</code></pre>
<h3>开机自启</h3>
<h4>服务端</h4>
<p><strong>Debian：</strong>
1.进入init.d：</p>
<pre><code>    cd /etc/init.d</code></pre>
<p>2.创建Shell脚本：</p>
<pre><code>    vi /etc/init.d/status-s</code></pre>
<p>3.编写启动脚本：</p>
<pre><code>    #! /bin/sh
    ### BEGIN INIT INFO
    # Provides: ServerStatus
    # Required-Start: $network $syslog
    # Required-Stop: $network
    # Default-Start: 2 3 4 5
    # Default-Stop: 0 1 6
    # Short-Description: Start ServerStatus
    # Description: ServerStatus
    ### END INIT INFO
    ServerStatus_DATA="/root/ServerStatus/server"
    WEB_DATA="/www/wwwroot/status"

    start()
    {
        echo "Start ServerStatus"
        cd "$ServerStatus_DATA"
        screen -dmS web ./sergate --config=config.json --web-dir="$WEB_DATA"
    }

    case "$1" in
        start)
            start
            ;;
        stop)
            stop
            ;;
        restart)
            stop
            #start
            ;;
        *)
            echo "Usage: /etc/init.d/status-s {start|stop|restart}"
            ;;
    esac</code></pre>
<p><strong>注意修改WEB_DATA后的路径为HTTP站点的绝对路径</strong></p>
<p>4.设置status-s为可执行脚本：</p>
<pre><code>    chmod 755 /etc/init.d/status-s</code></pre>
<p>5.设置status-s开机自启：</p>
<pre><code>    update-rc.d status-s defaults</code></pre>
<p>测试下脚本可用性：</p>
<pre><code>    /etc/init.d/status-s start</code></pre>
<p>若不报错echo Start ServerStatus，则脚本可用：</p>
<p><img src="https://img.timelate.com/i/2025/07/31/f521917a9fd8f217ad000ef7dcd0df9c.webp" alt="" /></p>
<p>重启测试：</p>
<pre><code>    reboot</code></pre>
<p>若想取消开机自启：</p>
<pre><code>    update-rc.d -f status-s remove</code></pre>
<p><strong>CentOS:</strong>
前4步都和Debian一样，完成前4步后，编辑rc.local</p>
<pre><code>    vi /etc/rc.d/rc.local</code></pre>
<p>在此文件末尾新开一行加上如下命令：</p>
<pre><code>    /etc/init.d/status-s start</code></pre>
<p>给权限，重启测试：</p>
<pre><code>    chmod +x /etc/rc.d/rc.local
    reboot</code></pre>
<h4>客户端</h4>
<p><strong>Debian</strong>
1.进入init.d：</p>
<pre><code>    cd /etc/init.d</code></pre>
<p>2.创建Shell脚本：</p>
<pre><code>    vi /etc/init.d/status-c</code></pre>
<p>3.编写启动脚本：</p>
<pre><code>    #! /bin/sh
    ### BEGIN INIT INFO
    # Provides: Status Clients
    # Required-Start: $network $syslog
    # Required-Stop: $network
    # Default-Start: 2 3 4 5
    # Default-Stop: 0 1 6
    # Short-Description: Start ServerStatus Clients
    # Description: Status Clients
    ### END INIT INFO
    ServerStatusC_DATA="/root/ServerStatus/clients"
    NAME_BIN="client-linux.py"

    start()
    {
        echo "Start ServerStatus Clients"
        cd "${ServerStatusC_DATA}"
        screen -dmS jp python "${NAME_BIN}"
    }

    case "$1" in
        start)
            start
            ;;
        stop)
            stop
            ;;
        restart)
            stop
            #start
            ;;
        *)
            echo "Usage: /etc/init.d/status-c {start|stop|restart}"
            ;;
    esac</code></pre>
<p>4.设置status-c为可执行脚本：</p>
<pre><code>    chmod 755 /etc/init.d/status-c</code></pre>
<p>5.设置status-c开机自启：</p>
<pre><code>    update-rc.d status-c defaults</code></pre>
<p>测试下脚本可用性：</p>
<pre><code>    /etc/init.d/status-c start</code></pre>
<p>若不报错echo Start ServerStatus Clients，则脚本可用：</p>
<p><img src="https://img.timelate.com/i/2025/07/31/f521917a9fd8f217ad000ef7dcd0df9c.webp" alt="" /></p>
<p>重启测试：</p>
<pre><code>    reboot</code></pre>
<p>若想取消开机自启：</p>
<pre><code>    update-rc.d -f status-c remove</code></pre>
<p><strong>CentOS:</strong>
前4步都和Debian一样，完成前4步后，编辑rc.local</p>
<pre><code>    vi /etc/rc.d/rc.local</code></pre>
<p>在此文件末尾新开一行加上如下命令：</p>
<pre><code>    /etc/init.d/status-c start</code></pre>
<p>给权限，重启测试：</p>
<pre><code>    chmod +x /etc/rc.d/rc.local
    reboot</code></pre>
<hr />
<p>DEMO：<a href="https://node.timelate.com">node.timelate.com</a></p>
<p>蜜汁标题，拟标题的时候我突然想到了老母猪的产后护理（雾</p>
]]></content:encoded>
<slash:comments>2</slash:comments>
<comments>https://www.timelate.com/{category}/ServerStatus.html#comments</comments>
</item>
</channel>
</rss>
