普通安装后端 - MiryanSir/pay-v2ray-sspanel-v3-mod_Uim-plugin GitHub Wiki

安装 V2Ray,仅适用于付费版

修改了官方安装脚本,用脚本指定面板信息,请务必删除原有的 config.json, 否则不会更新 config.json

首次安装(这里保持最新版本)

参数解释:

--panelurl https://google.com  表示 WEBAPI URL
--panelkey 55fUxDGFzH3n  表示 MU KEY
--nodeid 123456  节点 ID,可以为 0
--downwithpanel 1  前端面板异常下线时,0 为节点端不下线、1 为节点跟着下线
--mysqlhost https://bing.com  数据库访问域名
--mysqldbname demo_dbname  数据库名
--mysqluser demo_user  数据库用户名
--mysqlpasswd demo_dbpassword  数据库密码
--mysqlport 3306  数据库连接端口
--speedtestrate 6  测速周期
--paneltype 0  面板类型,0 为 ss-panel-v3-mod、1 为 SSRPANEL
--usemysql 0  连接方式,0 为 webapi,1 为 MySQL 数据库连接,请注意 SSRPANEL 必须使用数据库连接

安装时请务必修改脚本参数

# ss-panel-v3-mod WEBAPI 连接示例
bash <(curl -L -s  https://raw.githubusercontent.com/rico93/pay-v2ray-sspanel-v3-mod_Uim-plugin/master/install-release.sh) \
--panelurl https://google.com --panelkey 55fUxDGFzH3n --nodeid 123456 \
--downwithpanel 1 --speedtestrate 6 --paneltype 0 --usemysql 0


# ss-panel-v3-mod MySQL 连接示例
bash <(curl -L -s  https://raw.githubusercontent.com/rico93/pay-v2ray-sspanel-v3-mod_Uim-plugin/master/install-release.sh) \
--nodeid 123456 \
--mysqlhost https://bing.com --mysqldbname demo_dbname --mysqluser demo_user --mysqlpasswd demo_dbpassword --mysqlport 3306 \
--downwithpanel 1 --speedtestrate 6 --paneltype 0 --usemysql 1


# SSRPANEL MySQL 连接示例
bash <(curl -L -s  https://raw.githubusercontent.com/rico93/pay-v2ray-sspanel-v3-mod_Uim-plugin/master/install-release.sh) \
--nodeid 123456 \
--mysqlhost https://bing.com --mysqldbname demo_dbname --mysqluser demo_user --mysqlpasswd demo_dbpassword --mysqlport 3306 \
--downwithpanel 1 --speedtestrate 6 --paneltype 1 --usemysql 1

一些命令

# 启动 V2Ray 进程
sudo systemctl start v2ray.service

# 重启 V2Ray 进程
sudo systemctl restart v2ray.service

# 停止 V2Ray 进程
sudo systemctl stop v2ray.service

# 开机自启 V2Ray 进程
sudo systemctl enable v2ray.service

# 取消开机自启 V2Ray 进程
sudo systemctl disable v2ray.service

后续升级(如果要更新到最新版本)

bash <(curl -L -s  https://raw.githubusercontent.com/rico93/pay-v2ray-sspanel-v3-mod_Uim-plugin/master/install-release.sh)

如果要强制安装某个版本

bash <(curl -L -s  https://raw.githubusercontent.com/rico93/pay-v2ray-sspanel-v3-mod_Uim-plugin/master/install-release.sh) -f --version 4.12.0

config.json Example

{
  "api": {
    "services": [
      "HandlerService",
      "LoggerService",
      "StatsService",
      "RuleService"
    ],
    "tag": "api"
  },
  "inbounds": [{
    "listen": "127.0.0.1",
    "port": 2333,
    "protocol": "dokodemo-door",
    "settings": {
      "address": "127.0.0.1"
    },
    "tag": "api"
  }
  ],
  "log": {
    "access": "/var/log/v2ray/access.log",
    "error": "/var/log/v2ray/error.log",
    "loglevel": "info"
  },
  "outbounds": [{
    "protocol": "freedom",
    "settings": {}
  },
    {
      "protocol": "blackhole",
      "settings": {},
      "tag": "blocked"
    }
  ],
  "policy": {
    "levels": {
      "0": {
        "connIdle": 300,
        "downlinkOnly": 5,
        "handshake": 4,
        "statsUserDownlink": true,
        "statsUserUplink": true,
        "uplinkOnly": 2
      }
    },
    "system": {
      "statsInboundDownlink": false,
      "statsInboundUplink": false
    }
  },
  "reverse": {},
  "routing": {
    "settings": {
      "rules": [{
        "ip": [
          "0.0.0.0/8",
          "10.0.0.0/8",
          "100.64.0.0/10",
          "127.0.0.0/8",
          "169.254.0.0/16",
          "172.16.0.0/12",
          "192.0.0.0/24",
          "192.0.2.0/24",
          "192.168.0.0/16",
          "198.18.0.0/15",
          "198.51.100.0/24",
          "203.0.113.0/24",
          "::1/128",
          "fc00::/7",
          "fe80::/10"
        ],
        "outboundTag": "blocked",
        "protocol": [
          "bittorrent"
        ],
        "type": "field"
      },
        {
          "inboundTag": [
            "api"
          ],
          "outboundTag": "api",
          "type": "field"
        },
        {
          "domain": [
            "regexp:(api|ps|sv|offnavi|newvector|ulog\\.imap|newloc)(\\.map|)\\.(baidu|n\\.shifen)\\.com",
            "regexp:(.+\\.|^)(360|so)\\.(cn|com)",
            "regexp:(.?)(xunlei|sandai|Thunder|XLLiveUD)(.)"
          ],
          "outboundTag": "blocked",
          "type": "field"
        }
      ]
    },
    "strategy": "rules"
  },
  "stats": {},
  "sspanel": {
      "nodeid": 123456,
      "checkRate": 60,
      "SpeedTestCheckRate": 6,
      "panelUrl": "https://google.com",
      "panelKey": "55fUxDGFzH3n",
      "downWithPanel": 1,
      "mysql": {
        "host": "https://bing.com",
        "port": 3306,
        "user": "demo_user",
        "password": "demo_dbpassword",
        "dbname": "demo_dbname"
      },
      "paneltype": 0,
      "usemysql": 0
    }
}

安装 Caddy

一键安装 Caddy 和 CF DDNS TLS 插件,不使用 WS + TLS 可不安装。

curl https://getcaddy.com | bash -s dyndns,tls.dns.cloudflare
Caddyfile

Caddyfile 自行修改,或者设置对应环境变量

{$V2RAY_DOMAIN}:{$V2RAY_OUTSIDE_PORT}
{
  root /srv/www
  log ./caddy.log
  proxy {$V2RAY_PATH} 127.0.0.1:{$V2RAY_PORT} {
    websocket
    header_upstream -Origin
  }
  gzip
  tls {$V2RAY_EMAIL} {
    protocols tls1.0 tls1.2
    # remove comment if u want to use cloudflare ddns
    # dns cloudflare
  }
}