在无GUI Linux系统中通过Web UI管理代理,可以极大地方便用户在命令行环境下进行代理服务器的配置和管理。以下是一个详细的教程,介绍如何使用Docker容器结合Mihomo(Clash的增强版)和Yacd Web UI,实现在Web端轻松管理代理和订阅。

首先,我们需要创建一个Docker Compose配置文件docker-compose.yml,该文件定义了Mihomo和Yacd的容器配置。具体配置如下:

tversion: '3.3'
services:
  mihomo:
    container_name: mihomo
    image: yilee01/mihomo-yacd:latest
    ports:
      - 7890:7890
      - 9090:9090
    volumes:
      - ./config:/root/.config/mihomo
    restart: on-failure:3

接下来,我们需要配置Mihomo的基本配置文件config.yaml,该文件位于./config/目录下。以下是config.yaml的配置示例:

mixed-port: 7890
allow-lan: true
external-controller: 0.0.0.0:9090

mode: rule
log-level: info
ipv6: false
unified-delay: true

geo-update-interval: 24
geox-url:
  geoip: https://gh-proxy.com/https://github.com/MetaCubeX/meta-rules-dat/releases/download/latest/geoip-lite.dat
  geosite: https://gh-proxy.com/https://github.com/MetaCubeX/meta-rules-dat/releases/download/latest/geosite.dat
  mmdb: https://gh-proxy.com/https://github.com/MetaCubeX/meta-rules-dat/releases/download/latest/geoip.metadb
  asn: https://gh-proxy.com/https://github.com/MetaCubeX/meta-rules-dat/releases/download/latest/GeoLite2-ASN.mmdb

`tun`:
  enable: false
  stack: system
  auto-route: true
  auto-detect-interface: true

# URL 延迟检测 通用配置
my-url-test: &my-url-test
  # 延迟检测 URL
  health-check:
    enable: true
    url: https://cp.cloudflare.com
    # 节点连通性检测时间,单位为秒
    interval: 300
    # 节点超时延迟,单位为毫秒
    timeout: 1000
    # 节点自动切换差值,单位为毫秒
    tolerance: 100

proxy-groups:
  - name: "第三方跳板1"
    type: select
    use:
     - "iKuuu_V2"

proxy-providers:
  "iKuuu_V2":
    type: http
    url: "xxxxxxxx"
    path: /root/.config/mihomo/test.yaml
    # 自动更新订阅时间,单位为秒
    interval: 3600 # 一小时
    # URL 延迟检测逻辑
    <<: *my-url-test

rules:
  #- PROCESS-PATH,/usr/bin/xray,DIRECT
  - PROCESS-NAME,ddns-go,DIRECT
  - PROCESS-NAME,xray,DIRECT
  - PROCESS-NAME,qbittorrent-nox,DIRECT
  - MATCH,第三方跳板1

配置完成后,启动服务:

docker compose up -d

在浏览器中访问http://服务器IP:9090即可打开Yacd管理界面。其中,端口7890为代理端口(SOCKS5/HTTP),端口9090为Yacd Web管理界面端口。

为了验证代理是否工作,可以使用以下命令:

curl --socks5 127.0.0.1:7890 https://ifconfig.me/ip

如果返回的IP地址与您的服务器IP不同,说明代理已成功工作。

标签: none

评论已关闭