Alpine系统相关Linux网络相关
Alpine系统NPS 穿透服务端完美安装指南
本方法不依赖任何不稳定的一键脚本,采用官方原版加 Alpine 自启固化,100% 成功。
步骤 1:下载并补齐正版官方组件
# 1. 创建并进入官方配置目录
mkdir -p /etc/nps && cd /etc/nps
# 2. 从官方源下载最新稳定版发布包(以 v0.26.10 为例)
wget https://github.com/ehang-io/nps/releases/download/v0.26.10/linux_amd64_server.tar.gz
# 3. 解压并补齐所有核心与网页静态文件
tar -zxvf linux_amd64_server.tar.gz
cp -r web /
# 4. 把主程序移动到系统全局变量中,并赋予最高执行与读取权限
mv nps /usr/bin/
chmod +x /usr/bin/nps
chmod -R 755 /etc/nps/web
chmod -R 755 /web
步骤 2:修改端口避免冲突(最核心)
默认的 80 和 443 极易与 Nginx 撞车。直接修改配置文件:
vi /etc/nps/conf/nps.conf
vi /etc/nps/conf/nps.conf
找到以下几行并修改(按 i 编辑,修改后按 Esc 输入 :wq 保存):
# 修改前:http_proxy_port=80 -> 修改后:
http_proxy_port=8088
# 修改前:https_proxy_port=443 -> 修改后:
https_proxy_port=8443
# 网页管理后台端口,可保持 8081 不变
web_port=8081
步骤 3:配置 Alpine 开机自动启动
由于 Alpine 没有 standard systemd,直接写入本地自启守候列表:
# 1. 创建自启文件并写入绝对启动命令
cat > /etc/local.d/nps.start << 'EOF'
#!/bin/sh
nps start
EOF
# 2. 赋予执行权限并校准格式
chmod +x /etc/local.d/nps.start
sed -i 's/\r$//' /etc/local.d/nps.start
# 3. 激活 Alpine 本地自启服务(如果未激活)
rc-update add local default
步骤 4:放行云厂商公网防火墙
去你的云服务器控制台(阿里云/腾讯云等),在“安全组/防火墙”中添加两条入站规则:
放行 TCP 端口 8081(NPS 后台网页管理)放行 TCP 端口 8024(NPS 客户端连接核心桥梁)
评论(2)
ffccc
6100