Advertisements

How To Install V2ray Websocket(WS)+TLS+CDN on a VPS

Advertisements

What is v2ray?

V2ray or vmess protocol to be precise, is a sophisticated version of the famous Shadowsocks. At the core, v2ray is also based on SOCKS5 proxy. Normally, proxies lack encryption, and that’s what differentiates a VPN and a proxy. Shadowsocks is SOCKS5 proxy with an encryption, and vmess is the next gen Shadowsocks. 

Advertisements

The previous article was about simple v2ray with tcp protocol, and that was enough for that time. But recently my v2ray tcp servers got blocked. So I believe it is time to move to more complicated configurations of v2ray. 

This method is called v2ray+websocket+tls+cdn (sometimes nginx is also added, if you  prefer to add a website). As to my understanding, this method hides your VPS IP address behind an IP address from a major CDN provider like Cloudflare, and most ISPs do not block those IP addresses.

Update 2021:

As the developer of v2-ui, changed the v2ray panel to x-ui, which is based on xray core, this tutorial is updated accordingly. The new panel has some design and functionality changes. Most of the installation is same as before. The x-ui panel is only in Chinese right now, but you can use google translate to understand it.

Note: I will update screenshots later.

Choosing a VPS

You should:

  • Before making payment ping an IP address of the VPS provider
  • Prefer hourly billing VPS services
  • Prefer less popular VPS services
  • Check for ratings and user reviews
  • Prefer KVM virtualization
  • Use a VPN when using Putty or an alternative SSH programme, to prevent IP address blocking

I can suggest these VPS services:

  1. Vultr – hourly billing – starting from $3.5 per month – vultr.com (get a $100 bonus)
  2. DigitalOcean – hourly billing – starting from $5 per month – digitalocean.com (get a $100 bonus)
  3. RackNerd – monthly billing – starting from $2 per month (annual subscription) – racknerd.com
  4. Contabo – monthly billing – starting from € 3.99 per month  – contabo.com
  5. CloudCone – hourly billing – starting from $4.2 per month – cloudcone.com

Setting up v2ray ws+tls+cdn 

Thanks to the one-command script by sprov065, you can install v2ray easily, even if you are not familiar with Linux commands. 

You need to have at least Ubuntu 16, Debian 8 or CentOS 7. 

This guide will be for Ubuntu.

The setup consists of two parts. First, the v2ray script installation, and the second is getting a free SSL certificate from Let’s Encrypt for TLS, and enabling CDN from Cloudflare. The second part is only needed if you wish to use tls and cdn.

Part one – install the script

1. First make updates and upgrades, and install curl

sudo apt-get update -y   sudo apt-get upgrade -y  sudo apt install curl -y

2. Run the x-ui script

bash <(curl -Ls https://raw.githubusercontent.com/vaxilu/x-ui/master/install.sh)

And that is it for the installation part.

v2ui

Part two – get the SSL Certificates

You will need:

  • A domain name
  • A Cloudflare account
  • Point your nameservers to Cloudflare
  • Point your VPS IP to your domain name

To get an SSL certificate, you need a domain name (www.example.com), preferably a paid one from providers like namecheap or porkbun, and a Cloudflare account. Both Porkbun and Namecheap have free Whois Guard. When it comes to pricing, Porkbun has an upper hand, you can find domain names for under $3 per year. Please do check the renewal prices before purchasing a domain.

 1. Nameservers configurationWhen adding your domain name to your Cloudflare account, Cloudflare will ask you to redirect your nameservers. It will be something like this:

example1.ns.cloudflare.com
example2.ns.cloudflare.com

You need to copy those from Cloudflare to your domain name registrar (ex: namecheap.com). On Namecheap you can find it on Domain List > Manage > Nameservers. Change the DNS to Custom DNS and add Cloudflare nameservers. After a while, Cloudflare will inform you that the setup is done.,

cloudflare_account_setup
cloudflare_account_setup2
namecheap_DNS
2. Connecting your domain name to the VPS IP address

On Cloudflare,

Advertisements
  1. Go to DNS Management
  2. Press “Add Record”
  3. Type your sub-domain name or domain name to “Name”  (ex: write test for test.example.com or @ for example.com)
  4. Write your VPS IP to “IPv4 address”.
  5. Make sure the color of “Proxy status” is orange and says DNS Only.

Note: If you keep DNS only status after SSL configuration mentioned below, you will get v2ray+ws+tls. If you change it to Proxied, you will get v2ray+ws+tls+cdn.

And lastly change SSL/TLS mode to Full or Full (strict).

cloudflare_DNS_only
cloudflare_SSL
3. Getting SSL Certificate

Now SSH to your VPS using Putty. 

  1. Install certbot.
sudo apt install software-properties-common  sudo add-apt-repository ppa:certbot/certbot  sudo apt-get install certbot

 2. Use certbot to get SSL Certificate. Use your own email address and domain name.

sudo certbot certonly --standalone --preferred-challenges http --agree-tos --email your-email-address -d test.example.com 

3. If you get a note like “Congratulations!..”, it means that now you have SSL certificate for your  domain/sub-domain.

In the text you will find destinations of your certificate file and key file. Copy them, as you will need  them on web panel. It will be something like this:

/etc/letsencrypt/live/test.example.com/fullchain.pem
/etc/letsencrypt/live/test.example.com/privkey.pem

Note:

If you face errors and cannot get the certificate, please make sure that your firewall is listening to ports 80 and 443, you have pointed your VPS IP address to the domain name and the Cloudflare CDN is off.

Advertisements

4. Last, the SSL certificate expires in 90 days, to make sure to renew it before expiration. Here is a manual renewal command.

certbot renew --force-renewal
LetsEncrypt_SSL

Managing  v2ray

Adding a user

You can go to x-ui web panel typing your IP address and the port (54321) on a browser. By default, both login and password are admin. You can change them in the panel settings.

http://"your-ip-address":54321

To add a user, you need to go to “accounts”, press add button and fill in the blanks according to  your preferences.

  • Remark – here you can write anything you want
  • Protocol – vmess
  • Listening IP, Port, ID (UUID) and Alter ID generated automatically. You can change them manually, as well. It is advised to use port 443. 
  • Transport – ws (websocket)
  • Path – you can leave it the way it is or add anything you want
  • Turn on TLS
  • Domain – write your domain name or sub-domain name
  • You can choose certificate file path and copy the file paths, or copy the certificate and key directly to certificate file content
  • Copy and paste certificate and key file paths, respectively
  • Press “Add”

And that is it. You can add, edit, delete users within seconds, and check bandwidth usage using x-ui web-panel. 

You are not only limited to v2ray ws tls cdn with this web panel, you can configure and test various combinations of v2ray.

I would like to thank vaxilu and other developers for this easy v2ray multi-user management panel.  

webpanel_1
webpanel_2

Bonus

BBR script

If you think your v2ray has slow speed, or have an older Linux version on your VPS, you can use bbr script by teddysun, to install google bbr.

wget -N --no-check-certificate https://github.com/teddysun/across/raw/master/bbr.sh && chmod +x bbr.sh && bash bbr.sh

Installing v2ray to Your Devices

v2ray apps for Android

You can use v2ray on several apps on Android, and all of them are available for free Google Play.

  • v2RayNG
  • Clash for Android
  • NapsternetV

v2ray apps for iOS

You can use v2ray on several apps on your iPhone/iPad as well, most of the v2ray apps are paid apps, except for 91VPN.

  • ShadowRocket
  • Kitsunebi
  • Quantumult
  • i2Ray
  • Pepi
  • 91VPN
  • Pharos Pro
  • FairVPN

v2ray clients for Windows

For your Windows PC, you can choose one of these five v2ray Windows clients. And here is a download link for the three of them. There are also new softwares called Clash (download it here) and Qv2ray (download it here).

  • V2RayW
  • V2RayN
  • V2RayS
  • Clash
  • Qv2ray
  • Netch

v2ray clients for macOS

For your Mac, you can choose one of these four v2ray clients. Here is a download link for V2RayX and here for V2RayU. The newsest additions to the list are ClashX (Click here to download) and Qv2ray (download it here) for macOS. 

  • V2RayX
  • V2RayU
  • ClashX
  • Qv2ray

VPN services that offer v2ray

Sometimes IP blocks are so often that you may want a solution without a hassle and go for a paid option. If that is the case for you, Wannaflix and 12VPN offer v2ray, along with other VPN protocols.

Advertisements

14,768 thoughts on “How To Install V2ray Websocket(WS)+TLS+CDN on a VPS

  1. Hello there! This article couldn’t be written much better!

    Reading through this post reminds me of my previous roommate!

    He constantly kept preaching about this. I am going to send this information to him.
    Fairly certain he will have a very good read. I appreciate you for sharing!

  2. Hi there, You’ve done a fantastic job. I will
    definitely digg it and personally suggest to my friends.
    I’m confident they’ll be benefited from this site.

  3. I’m excited to discover this page. I wanted to thank you
    for your time for this fantastic read!! I definitely appreciated every part of it and
    i also have you book marked to see new information on your blog.

  4. Hello, i read your blog from time to time and i own a
    similar one and i was just wondering if you get a
    lot of spam responses? If so how do you prevent it, any plugin or anything you can advise?

    I get so much lately it’s driving me mad so any help is
    very much appreciated.

  5. На сайте http://www.pro-certification.ru вы сможете воспользоваться такой важной услугой, как профессиональная сертификация. В компании работают компетентные сотрудники, которые знают свою работу детально и берутся за подписание разрешительной документации. Все работы выполняются по доступной стоимости, качественно, в соответствии с нормативами. Компания окажет вам помощь и в том случае, если возникли проблемы при ввозе товара из-за рубежа. Для того чтобы получить профессиональную консультацию, позвоните по указанному телефону.

  6. I think this is one of the most vital information for me.
    And i am glad reading your article. But wanna remark on some general things, The site style
    is wonderful, the articles is really great : D. Good job,
    cheers

  7. Do you have a spam problem on this site; I also am a blogger, and I was curious
    about your situation; many of us have developed some nice procedures and we are looking to exchange solutions with others, why not shoot me an e-mail if
    interested.

  8. Please let me know if you’re looking for a article writer for your site.
    You have some really great articles and I think I would be
    a good asset. If you ever want to take some of the load off, I’d really like to write some material for your blog in exchange for a link back to mine.
    Please send me an email if interested. Thanks!

    My webpage :: 먹튀검증업체

  9. Its like you read my thoughts! You appear to understand a lot approximately this, like
    you wrote the guide in it or something. I believe that you
    could do with some percent to pressure the message home a bit, but
    instead of that, that is excellent blog. A great read.
    I will definitely be back.

  10. Greetings from Los angeles! I’m bored at work so I decided to browse
    your blog on my iphone during lunch break. I really like the info you
    provide here and can’t wait to take a look when I get home.
    I’m surprised at how quick your blog loaded on my phone ..
    I’m not even using WIFI, just 3G .. Anyways, fantastic
    blog!

  11. I’m curious to find out what blog system you have beewn using?
    I’m having some small security problems with my latest blog andd I’d lie to find something
    more secure. Do you have any recommendations?

    Feel free to visit my homepage; Doctor on call

  12. I have fun with, result in I found exactly what I was taking a look for.
    You have ended my four day lengthy hunt! God
    Bless you man. Have a great day. Bye

  13. After I initially left a comment I appear to have clicked
    the -Notify me when new comments are added- checkbox and now whenever
    a comment is added I recieve four emails with the same comment.
    Perhaps there is an easy method you can remove me from that
    service? Appreciate it!

  14. Heya i’m foг tһe primary time һere. I ϲame аcross thіs board and I in finding It truly helpful & it helped mе oᥙt a lot.
    I hope to provide one thing back and help others
    lіke yoս aided mе.

    Feel free tօ visit my web page: surfing tips

  15. [url=http://motiliumtabs.monster/]buy motilium australia[/url] [url=http://acyclovir.download/]zovirax 800 mg price[/url] [url=http://augmentin.pics/]online amoxicillin prescription[/url] [url=http://bactrimp.online/]bactrim f[/url] [url=http://azithromycinv.com/]how to get zithromax[/url] [url=http://motilium.icu/]generic motilium[/url] [url=http://finasteride.charity/]propecia cost in canada[/url] [url=http://tretinoin.pics/]order tretinoin from india[/url]

  16. Wonderful beat ! I would like to apprentice while you amend
    your website, how can i subscribe for a blog website? The account helped me a acceptable deal.
    I had been a little bit acquainted of this your broadcast provided bright clear idea

  17. I’m not sure why but this web site is loading
    incredibly slow for me. Is anyone else having this issue or is it a issue on my
    end? I’ll check back later and see if the problem
    still exists.

Leave a Reply

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

Advertisements