V2Ray Backend

V2RAY backend setup tutorial, supports the SS-PANEL backend

The environment can be CENTOS, debian, or ubuntu; the latest version is recommended.

Step 1: update the server environment packages to avoid problems later.
ubuntu debian: use the following command
apt update && apt upgrade -y

Step 2: run the automatic script

bash <(curl -L -s https://raw.githubusercontent.com/v2rayv3/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 0 –speedtestrate 6 –paneltype 0 –usemysql 1 –cfemail xxxx –cfkey xxxx

Parameter description

nodeid  : panel node ID

mysqlhost  : domain name or server IP

dbname: database name

demo_dbname: database username

demo_password: database password

usermysql : defaults to 1   (uses direct MySQL connection with database number and password)

cfemail : means the Cloudflare email

cfkey: the domain's global API address in Cloudflare

Set V2RAY rules in the panel

// TCP example, please note there are two semicolons at the end
xxxxx.com;non-0;16;tcp;;

// WS
xxxxx.com;10550;16;ws;;path=/v2ray|host=oxxxx.com

// WS + TLS (provided by Caddy)
xxxxx.com;0;16;tls;ws;path=/v2ray|host=Caddy TLS address|inside_port=10550

// nat🐔 ws
xxxxx.com;non-0;16;ws;;path=/v2ray|host=oxxxx.com

// nat🐔 ws + tls (provided by Caddy)
xxxxx.com;0;16;tls;ws;path=/v2ray|host=Caddy TLS address|inside_port=10550|outside_port=11120

// The following are KCP examples, supporting all V2Ray types:

// none: default value, no obfuscation; the transmitted data is featureless packets.
xxxxx.com;non-0;16;kcp;noop;

// srtp: disguises as SRTP packets and will be identified as video call traffic (such as FaceTime).
xxxxx.com;non-0;16;kcp;srtp;

// utp: disguises as uTP packets and will be identified as BT download traffic.
xxxxx.com;non-0;16;kcp;utp;

// wechat-video: disguises as WeChat video call packets.
xxxxx.com;non-0;16;kcp;wechat-video;

// dtls: disguises as DTLS 1.2 packets.
xxxxx.com;non-0;16;kcp;dtls;

// wireguard: disguises as WireGuard packets (not the real WireGuard protocol).
xxxxx.com;non-0;16;kcp;wireguard;

For example, if we use the ws websocks encryption method to set the V2RAY proxy mode,
fill in the following parameters on the panel:
47.240.69.185;10550;2;ws;;path=/v2ray|host=www.gov.com.hk
47.240.69.185 is the ID
10550 is the websocks port you set, which is 10550
host=www.gov.com.hk  disguises it as www.gov.com.hk for unrestricted internet access

non-0 –>> we recommend changing it to 2, otherwise the node server will keep this as non-0.
This parameter is the alter ID, an extra ID.

Server configuration file directory, or you can run this script as you like, then edit this file and restart V2RAY to enable the backend connection.

/etc/v2ray/config.json
 "sspanel": {
    "nodeid": 123456,  configured node ID
    "checkRate": 60,   re-fetch data from the database every 60 seconds
    "SpeedTestCheckRate": 6,  speed test interval
    "panelUrl": "https://google.com",   set the panel URL for panelurl
    "panelKey": "55fUxDGFzH3n",     the panel key
    "downWithPanel": 0,
    "mu_regex":  "%5m%id.%suffix",      muapi setting
    "mu_suffix": "microsoft.com",
    "mysql": {
      "host": "https://bing.com",  database address
      "port": 3306,                database port
      "user": "demo_user",        database username
      "password": "demo_dbpassword",   database password
      "dbname": "demo_dbname"   database name
    },
    "paneltype": 0,
    "usemysql": 1,  if you use the API, please set this to 1
    "cf_key": "xxxx",    your domain's global API on Cloudflare
    "cf_email": "xxxx"    your Cloudflare email

Command to check the V2RAY server running status

tail -f /var/log/v2ray/error.log

Install using Docker

First install Docker

curl -fsSL https://get.docker.com -o get-docker.sh  && 
bash get-docker.sh

Run with the docker run command

By default, port 51201 mapping is enabled. Please modify the port mapping according to your needs.

docker run -d --name=nickname
-e speedtest=0  -e api_port=2333 -e usemysql=0 -e downWithPanel=0 
-e node_id=73 -e sspanel_url=website WebAPI address -e key=Sspanel_Mu_Key  -e MYSQLHOST=database IP address  
-e MYSQLDBNAME="demo_dbname" -e MYSQLUSR="demo_user" -e MYSQLPASSWD="demo_dbpassword" -e MYSQLPORT=3306 
--log-opt max-size=10m --log-opt max-file=5 
--net=bridge -p 51201:51201/tcp -p 51201:51201/udp --restart=always 
rico93/v2ray_v3:go_pay

Optional variable groups for connection configuration, explanation of variables; remove as needed

webapi: -e usemysql=0  -e sspanel_url=website WebAPI address -e key=Sspanel_Mu_Key
mysql: -e usemysql=1  -e MYSQLHOST=database IP address -e MYSQLDBNAME="demo_dbname" -e MYSQLUSR="demo_user" -e MYSQLPASSWD="demo_dbpassword" -e MYSQLPORT=3306
Limit memory usage:--memory="300m"  --memory-swap="1g"
Used for DDNS and automatic TLS, requires a CF domain: -e CF_Key=bbbbbbbbbbbbbbbbbb -e [email protected]
Streaming media DNS configuration, enter the unblocking DNS: -e LDNS=1.1.1.1

Some commands

View logs

docker logs nickname –tail 100

Second method

Script supports:

  • View logs
  • Pull and update the image
  • Update docker-compose.yml
  • Install docker and docker-compose

Install using docker-compose

Please provide the requested information during the installation process

mkdir v2ray-agent && cd v2ray-agent &&
curl
https://raw.githubusercontent.com/v2rayv3/pay-v2ray-sspanel-v3-mod_Uim-plugin/master/install.sh
-o install.sh && chmod +x install.sh &&
bash install.sh

Some commands

Please run them in the same directory as docker-compose.yml.

# Update and pull the image
docker-compose pull

# Create and start the container; add -d to run in the background
docker-compose up

# Restart the container
docker-compose restart

# Stop the container
docker-compose stop

# Stop and remove the container
docker-compose down

# View logs
docker-compose logs

 About memory optimization
Edit the /etc/systemd/system/v2ray.service file on the VPS, and change ExecStart=/usr/bin/v2ray/v2ray -config /etc/v2ray/config.json to ExecStart=/usr/bin/env v2ray.ray.buffer.size=1 /usr/bin/v2ray/v2ray -config /etc/v2ray/config.json, then save it; after that, run the command below to apply the changes.

Then enter the command below to update the buffer size

Reload the v2ray parameters and start it again

sudo systemctl daemon-reload && sudo systemctl restart v2ray.service

Leave a Comment

Your email address will not be published. Required fields are marked *

中文 EN
🚀

RedGate VPN

免费节点太挤太慢?
升级高速稳定专线

立即体验 →

告别卡顿

RedGate VPN
全球高速节点

免费下载 →
Scroll to Top