Welcome to “How To Setup V2ray Proxy Server With A VPS” In this blog, we will provide complete information on mastering V2Ray, an effective open-source network proxy tool. Whether you are new to V2Ray or in search of to enhance your skills, this walkthrough will equip you with the information to effectively set up and optimize V2Ray on a Virtual Private Server (VPS).
V2Ray, famous for its flexibility and robustness, permits you to bypass network restrictions, enhance privacy, and invulnerable your online communications. However, putting up and configuring V2Ray on a VPS might also appear challenging to beginners. That’s where this blog comes in. We will guide you via every step, from selecting a VPS provider and setting up a connection to installing V2Ray, configuring each server and client settings, and optimizing its overall performance.
Table of Contents
ToggleChoosing the right VPS (Virtual Private Server) is crucial when setting up V2Ray. the chosen VPS must have good:
Location and Geo-Restrictions: The geographical location of your VPS affects the accessibility and bypassing of geo-restricted content. If you require V2Ray to access content from specific regions or to bypass censorship, selecting a VPS located in a suitable location can significantly enhance your ability to overcome such restrictions.
Network Speed and Latency: V2Ray heavily relies on network speed and latency to deliver fast and efficient proxy services. Selecting a VPS provider with good network infrastructure and low latency helps minimize delays and ensures optimal communication between V2Ray clients and the server.
Scalability and Flexibility: Your VPS provider should offer scalability options to accommodate your future needs. As your V2Ray usage grows, you may require additional resources or the ability to scale up your VPS plan. Choosing a provider that offers easy scalability ensures seamless expansion without disruptions.
It took some time but I was able to make a list of the best VPS to choose from
Check out: Top 10 best free VPS providers
It doesn’t matter which VPS you have chosen just make sure that when you create your VM you do the following.
Fill in the rest of the required information and create your VM.
Important step: how to set up a firewall and open all ports in a VPS
When looking to buy a cheap domain name, there are several reputable websites you can consider:
It’s important to note that while price is a consideration, it’s also essential to choose a reputable registrar with good customer support and reliable service. Take the time to compare prices, features, and customer reviews to ensure you select the best option for your needs.
follow the tutorial link below to Point your domain DNS to Cloudflare: How to add a domain on Cloudflare
log in to your V2 Ray server using an SSH client the client that I usually go for is called Putty.
Once you have downloaded and installed Putty open it.
once you’ve got Putty open you’ll need to enter the hostname or IP address of our V2 Ray proxy server to do this we’ll need to open back up our browser go to our VPS provider Tab and then copy the IP address of our server. paste it on host name and click open.
if you are using oracle cloud follow:
Install putty on the search for putty gen on your Windows search bar, open putty gen.
Now search for putty and open it.
To activate root type:
sudo-i
update your server:
apt-get update
Once our server has been updated the next thing we need to do is to download and install the V2 Ray proxy server onto our VPS do this with the following command
bash <(curl -L https://raw.githubusercontent.com/v2fly/fhs-install-v2ray/master/install-release.sh)
The next thing we need to do is enable V2ray do this with the following command
systemctl enable v2ray
Start V2ray with
systemctl start v2ray
Check you V2ray status
systemctl status v2ray
It must be like this:
navigate to the V2ray folder using the following command
cd /usr/local/etc/v2ray
now we need to open the JSON and edit it, we will use nano to open it so type:
nano config.json
delete everything there
Click the link below to generate a UUID that we are going to use bellow
copy your UUID and copy the following, then paste it on your notepad
{
"inbounds": [
{
"port": 10000,
"listen":"127.0.0.1",
"protocol": "vmess",
"settings": {
"clients": [
{
"id": "86230575-318c-47e2-9d7d-a26c4b9733c1",
"alterId": 0
}
]
},
"streamSettings": {
"network": "ws",
"wsSettings": {
"path": "/v2ray"
}
}
}
],
"outbounds": [
{
"protocol": "freedom",
"settings": {}
}
]
}
replace the current UUID with the one you generated on the website, as shown in the image below
copy all the edited text and paste it on Putty by right-clicking on your mouse
now what we’ll need to do is save the changes that we have just made to the config. type Ctrl+O on your keyboard it will then ask you to name your file you must leave it as config.json and then hit enter on your keyboard great so the changes you have just made to your file have been saved now what we need to do is exit the Nano text editor by pressing Ctrl+X on your keyboard.
to go back to our root directory type CD and enter
next thing we need to do is set up our nginx web server to do this type:
apt-get install nginx -y
we need to type the command to get our lets encrypt SSL certificate to do this type the following command:
apt-get install certbot python3-certbot-nginx
you’ll be asked to enter your email address which as you can see says used for Urgent renewal and security notices so I’m just going to enter my email address now once you’ve entered your email address hit enter on your keyboard.
you’ll then be asked to read the terms of service if you agree to those terms please read the terms of service I’m going to press Y and then hit enter you’ll then be asked if you would like to share your email address with the Electronic Frontier Foundation which is a partner of let’s encrypt and cert box I’m going to type n for now hit enter on my keyboard.
you’ll be asked to enter the domain names you would like on your certificate this is where we enter the domain name we purchased before, type it and click enter
if successful you should see the message which says successfully deployed certificate 4 and then your domain name congratulations you have successfully enabled.
now got our SSL certificate we can check the certificate if it has indeed been issued by opening up our browser and opening up a fresh Tab and then go to your domain: it must be like this
go back to Putty the next thing we need to do is set up our Nginx configuration file to do this you’ll need to navigate to the file by typing in the following command:
cd /etc/nginx/sites-available
now type ls and click enter, then you will see a file called default this time instead of opening up our file using a text editor we’re actually going to delete it. type:
rm default
now recreate the file by typing: nano default and then click enter
copy the following and replace domain.com with your domain name:
server {
listen 80;
server_name domain.com;
return 301 https://domain.com$request_uri;
}
server {
listen 443 ssl;
server_name domain.com;
ssl_certificate /etc/letsencrypt/live/domain.com/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/domain.com/privkey.pem;
include /etc/letsencrypt/options-ssl-nginx.conf;
ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem;
location / {
root /var/www/html;
index index.html index.htm index.nginx-debian.html;
}
location /v2ray {
if ($http_upgrade != "websocket") {
return 404;
}
proxy_redirect off;
proxy_pass http://127.0.0.1:10000;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_set_header Host $host;
# Show real IP in v2ray access.log
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
}
replace just the highlighted parts as shown in the image below
now select Ctrl+A to select the whole thing and paste it back on Putty by right-clicking on your mouse.
systemctl restart nginx
systemctl status v2ray
close putty and now what we need to do is install the V2 Ray client so that we can connect to our server to do this open up your browser and click here
install the downloaded software don’t open it yet, just download the v2ray core using this link
{
"inbounds": [
{
"port": 1080,
"listen": "127.0.0.1",
"protocol": "socks",
"sniffing": {
"enabled": true,
"destOverride": ["http", "tls"]
},
"settings": {
"auth": "noauth",
"udp": false
}
}
],
"outbounds": [
{
"protocol": "vmess",
"settings": {
"vnext": [
{
"address": "domain.com",
"port": 443,
"users": [
{
"id": "0446e7c7-b95d-45f8-a813-8fd9426cbe4e",
"alterId": 0
}
]
}
]
},
"streamSettings": {
"network": "ws",
"security": "tls",
"wsSettings": {
"path": "/v2ray"
}
}
}
]
}
replace domain.com and UUID with your domain and UUID respectively replace the UUID with the one you generated before on the website.
now save and rename the document as v2ray.json as show in the image below
now open the Qv2ray software you have previously installed.
click on preferences and then click on kernel settings in the kernel settings you will need to select two file path locations the first one is for the V2Ray core executable path and the VRay assets directory for the V2Ray core executable path to the right-hand side of it click on select.
navigate your desktop and look for your v2ray dash Windows that’s 64. the folder that you extracted from the zip file double click on it to go into it and then select the V2 Ray executable file which is the dot exe.
locate the v2ray.json file on your desktop and click on it. the click import
to connect to the server right click on the v2ray.json and click on the play icon as shown in the image below
We have detected that you are using extensions to block ads. Please support us by disabling these ads blocker.