使用 pip 安装

35771599dd 2026-08-03 AstrillVPN 27 0

Quantumult 是一个高性能的反向代理服务器,常用于负载均衡、压力测试和内容缓存等场景,以下是 Quantumult代理配置的基本步骤和示例:

安装 Quantumult

在安装 Quantumult 之前,确保你的系统满足以下要求:

  • Python 3.6 或更高版本
  • pip 或 pip3(根据你的 Python 版本选择)
# 或使用 pip3
pip3 install quantumult

配置 Quantumult

配置文件通常存放在 quantumult.confquantumult.yml 文件中,以下是一个基本的配置示例:

# quantumult.yml
server:
  listener: 0...:80
  max_connections: 100
  timeout: 600
  keepalive: 100
  gzip: true
routes:
  - uri: /api
    backend: http://127...1:800
    prefix: /
    match: /
    pass_headers: true
    rewrite: false
  - uri: /static
    backend: http://127...1:800
    prefix: /static
    match: /
    pass_headers: true
    rewrite: false
  - uri: /*
    backend: http://127...1:800
    prefix: /
    match: /
    pass_headers: true
    rewrite: false
health_check:
  enabled: true
  uri: /health
  method: GET
  timeout: 5
  interval: 30
  healthy_threshold: 3
  unhealthy_threshold: 5

启动 Quantumult

启动 Quantumult 代理服务器:

quantumult -c quantumult.yml

配置 Nginx 与 Quantumult

如果你想将 Nginx 与 Quantumult 集成,可以在 Nginx 配置文件中将请求代理到 Quantumult:

server {
    listen 80;
    server_name yourdomain.com;
    location / {
        proxy_pass http://127...1:80;  # Quantumult 的监听地址和端口
        proxy_set_header Host $host;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Forwarded-Proto $scheme;
    }
}

高级配置

以下是一些高级配置示例:

负载均衡

routes:
  - uri: /
    backend: http://127...1:800
    prefix: /
    match: /
    pass_headers: true
    rewrite: false
    load_balancer:
      method: round_robin
      options:
        weight: 1

过滤规则

filters:
  - name: replace
    match: "^/api"
    replace: "https://$1"
    type: redirect

缓存

cache:
  enabled: true
  max_size: 1G
  max_age: 360
  store: disk
  path: /cache

常用命令

  • 启动 Quantumult:
    quantumult -c quantumult.yml
  • 停止 Quantumult:
    quantumult -c quantumult.yml stop
  • 重启 Quantumult:
    quantumult -c quantumult.yml restart
  • 查看运行状态:
    quantumult -c quantumult.yml status

注意事项

  • 配置文件路径必须正确,确保 Quantumult 能够找到配置文件。
  • 配置文件中的路径和端口需要根据实际情况调整。
  • 对于生产环境,建议设置更严格的安全配置和访问控制。

如果你遇到任何问题,可以参考 Quantumult 的官方文档或社区求助。

使用 pip 安装

扫码添加AstrillVPN官网微信

扫码添加AstrillVPN官网微信

029-8826-4715
扫码添加AstrillVPN官网微信

扫码添加AstrillVPN官网微信

网站地图