Learn how to set up V2Ray from scratch, including server deployment and client configuration on Windows, macOS, and Linux.
# Complete V2Ray Setup Guide 2026
## What is V2Ray?
V2Ray is a powerful network proxy tool that supports multiple protocols including VMess, VLess, Trojan, and Shadowsocks. It's designed to help users bypass network restrictions while maintaining good performance.
## Prerequisites
- A VPS with Ubuntu 20.04+ or Debian 10+
- SSH access to your server
- Basic command line knowledge
- A domain name (optional but recommended)
## Step 1: Server Setup
### Update System
```bash
sudo apt update && sudo apt upgrade -y
```
### Install V2Ray
```bash
# Official installation script
bash <(curl -L https://raw.githubusercontent.com/v2fly/fhs-install-v2ray/master/install-release.sh)
# Verify installation
v2ray --version
```
## Step 2: Configure V2Ray
### Create Configuration File
```bash
sudo mkdir -p /etc/v2ray
sudo vi /etc/v2ray/config.json
```
### Basic Configuration (VMess Protocol)
```json
{
"log": {
"access": "/var/log/v2ray/access.log",
"error": "/var/log/v2ray/error.log",
"loglevel": "warning"
},
"inbounds": [
{
"port": 10086,
"protocol": "vmess",
"settings": {
"clients": [
{
"id": "b831381d-6324-4d53-ad4f-8cda48b30811",
"alterId": 0
}
]
}
}
],
"outbounds": [
{
"protocol": "freedom",
"settings": {}
}
]
}
```
## Step 3: Configure Nginx (Optional but Recommended)
### Install Nginx
```bash
sudo apt install nginx -y
sudo systemctl enable nginx
```
### Configure SSL with Let's Encrypt
```bash
sudo apt install certbot python3-certbot-nginx -y
sudo certbot --nginx -d yourdomain.com
```
## Step 4: Client Configuration
### Windows
1. Download V2RayN from GitHub
2. Import configuration
3. Start proxy
### macOS
1. Download V2RayX
2. Configure server details
3. Enable system proxy
### iOS
1. Download Shadowrocket or V2Box
2. Add server configuration
3. Connect
## Step 5: Test Your Setup
```bash
# Check V2Ray status
sudo systemctl status v2ray
# Check logs
sudo tail -f /var/log/v2ray/error.log
```
## Security Tips
- Always use TLS encryption
- Enable firewall rules
- Keep V2Ray updated
- Use strong UUIDs
💬 Comments are not configured
Please set NEXT_PUBLIC_WALINE_SERVER_URL environment variable