服务器 IP 在墙内的话需要使用代理
我用的是 CentOS 7, clash 代理, 自行找个可靠的就行
客户端用的是 https://github.com/Dreamacro/clash/releases (404? 2023 年底 Clash 系列集体删库跑路)
使用方式很简单,下载解压,重命名为 clash
,增加执行权限 sudu chmod +x clash
,添加配置文件 config.yaml
,就可以执行
订阅地址 url 先转换 https://acl4ssr-sub.github.io/
再用 wget 或者在浏览器访问上面转换后的链接,下载后重命名为配置文件 ~/.config/clash/config.yaml
编辑 config.yaml
增加 external-controller
和 secret
以供外部浏览器访问进行设置
# HTTP 代理端口
# port: 7890
# Socks5 代理端口
# socks-port: 7891
# 混合代理端口
mixed-port: 7890
# 需要开启局域网访问
allow-lan: true
# 代理模式
mode: Rule
# 外部访问端口
external-controller: :9527
# 外部访问密钥 可以自己设置为别的字符串
secret: f85d4ff7-ce69-4634-a113-c607f2b35fbc
以上设置完毕就可以在外部网页端进行clash的配置 http://clash.razord.top/
设置后台执行
将 Clash 注册为服务,并设置为开机自启动
将以下脚本保存为 /etc/systemd/system/clash.service
[Unit]
Description=Clash Service
After=network.target
[Service]
Type=simple
User=root
ExecStart=/root/clash
Restart=on-failure
RestartPreventExitStatus=23
[Install]
WantedBy=multi-user.target
服务相关命令
# 重载服务
sudo systemctl daemon-reload
# 开机启动
sudo systemctl enable clash
# 停止服务
sudo systemctl stop clash
# 启动服务
sudo systemctl start clash
# 查看服务状态
sudo systemctl status clash