准备工具
- VPS一台
- 能正常解析域名一个(如果只是临时用用这里推荐在freename注册一个免费域名)
- Putty等vps远程管理客户端
VPS性能还是有一定要求:CPU: 1G核兹,内存大于512mb,如要长期维护网站磁盘空间最好大于15G。能达到以上要求方能正常运转,宝塔面板本身搭建以后就比较吃内,内存过小很容易当机。最好内存有768及以上。
1. 添加A记录,解析你的域名到主机IP,这里最好使用二级域名,以免出现主域名被封后只能换其他新域名的情况。
2. 登陆你的vps安装宝塔,如果在windows系统这里使用Putty进行登陆,如果你使用Mac可以直接使用系统自带终端登陆。mac终端登陆命令如下:
ssh [email protected].xxx.xxx.xxx // xxx请换成你相应ip
同步VPS系统时间
查看vps系统时间是否与本地同步,v2ray有可能会因主机时间与本地时间差异导致无效的情况。
查看时间命令:
date
如时间有差异,执行以下命令进行主机与本地时间同步即可
rm -rf /etc/localtime
ln -s /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
安装BT宝塔面板
时间同步以后开始安装宝塔面板,根据自己的系统运行以下相应脚本即可
Debian系统安装宝塔面板脚本如下:
wget -O install.sh http://download.bt.cn/install/install-ubuntu_6.0.sh && bash install.sh
Centos系统安装宝塔面板脚本如下:
yum install -y wget && wget -O install.sh http://download.bt.cn/install/install_6.0.sh && sh install.sh

宝塔面板安装完以后根据上图提示的地址和密码,在浏览器中打开登录你的宝塔面板,并安装相应组件,这里ftp一般用不上可以不用安装以节省服务器性能。极速安装有时候容易出错,如使用debian,这里最好使用编译安装。编译安装需要一定时间,耐心等待一会儿,一般在十分钟左右。如真心有建站需求这里还是推荐使用Centos7及以上系统。

安装完成以后开始建立相应网站,在左侧找到网站–>添加站点–>提交 如下图:

提交以后开始部署网站SSL证书如下图:

依次步骤如下,在左侧找到SSL–>选择Let’s Encrypt–>点选上你的域名,点击申请–>证书申请成功以后,点击开启强制https。 如下图:

以上步骤操作完成以后,打开浏览器输入你的网址,当出现下图页面,并在网址前面有小锁图标的情况下说明网站安装成功并切SSL证书部署成功!这里证书部署很重要,如SSL证书申请不成功,v2ray安装以后是绝对无法正常使用!

接下来开始安装v2ray,回到你的windows putty界面,或mac终端界面。这里我们使用了233大神的一件安装脚本节以约时间,当然你也可以使用官方脚本进行安装更纯净。复制下面的代码粘贴到putty或mac终端中并回车。
bash <(curl -s -L https://git.io/v2ray.sh)
1. 出现以下界面 选择1.安装,开始安装v2ray。

2.选择传输协议,脚本默认安装1.tcp协议。我们这里要选择4. Websocket+tls协议,在下面输入4并回车

3.端口默认即可,直接回车(这里请记住端口号,后面我们配置的时候会用到)

4.输入你绑定新建网站的域名,域名别输错,这里使用的域名是你前面安装网站的域名。输入后回车

会提示是否正确解析输入 Y 并回车

这里默认自动配置tls即可

5.开启伪装分流,这里我们要输入一个伪装路径,这个路径会在后面我们配置的时候用到,路径输入不用带”/ “,直接输入字母或数字就好,输入后回车


6.输入一个伪装网址,可以是任意网站,当然也可以不输入,默认有一个网址


这里提示我们是否安装ss,个人觉得没必要了,已经使用v2ray,再安装有点耗费主机资源,这里演示我们就不安装ss了,如有需要可安提示操作即可。

开始跑代码,这里取决于你vps性能和网速了,一般2-5分钟就会安装完成。

出现下图界面说明v2ray已经安装成功,可以不用急着关闭,等下配置其他会用到这里的信息。如不小心关闭,可以重新登陆主机输入 v2ray 回车查看v2ray信息。

至此整个v2ray安装搭建已经完成,获取v2ray订阅地址请输入以下命令
v2ray ural //输入这条命令会生成一个vmess链接,这个链接地址直接粘贴到你所使用客户端即可
v2ray qr //输入这条命令会生成一个二维码链接,手机客户端直接扫码订阅就好
当以上步骤操作完以后还无法正常使用,v2ray客户端开启以后还是无法正常访问,这里我们还需要配置网站nginx。
接下来回到宝塔面板,依次点击左侧网站–>选择设置–>选择配置文件

在弹出窗口拉到最下面,在下图所标记位置敲两下回车,并粘贴下面的代码,代码中分流地址以及端口号请相应改成你v2ray安装过程所输入的分流地址(注:这里分流地址前面要带“ / ”)及生成的端口号,否则v2ray不能正常使用。切记千万不要直接复制我的代码粘贴以后不修改!

location /down { // 这里对应改成你安装过程输入的分流路径
proxy_redirect off;
proxy_pass http://127.0.0.1:31992; // 这里的端口号对应改成你安装过程的端口号
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_set_header Host $http_host;
}

以上步骤操作完以后就可以点击保存啦。至此整个安装步骤完成,v2ray已经可以正常使用,网站也搭建在主机上啦,你可以在宝塔面板里面搭建一个 wordpress 或其他 cms 论坛等等其他程序了,愉快的玩耍吧!
文章评论
感谢你帮我把图保存了!
Hmm iis anyone ellse experiencing problems with thhe pictures on this blog loading?
I'm trting tto figure out if its a problem on my end or iff it's the blog.
Any suggestionss wold bbe greatly appreciated.
Pretty! This was an extrremely wondedful post. Many thanks forr providing thiks info.
That iss a ery goood tip particularly to those freshh to the
blogosphere. Shoft but very precise information… Thanks ffor sharing
ths one. A must resad article!
Helpo I am sso delighted I found yur webpage, I really found you by error, while I was lookinjg oon Yajoo forr something else,
Anyyways I am here now and would just like too say tuanks a lot ffor a
emarkable post and a alll round thrilling blog (I
also loe the theme/design), I don’t have time to browswe itt all aat the
minuute buut I have bookmaked it and alpso added your RSS feeds,
soo when I habe time I will be bwck tto read a gfeat deal more, Please do keep
up the excellent jo.
Ilike reading through a ppst that will make peoplpe think.
Also, many tanks foor prmitting me to comment!
I constantly spent mmy hhalf an houur to resd this website's articles or reviews daily along with a mug
of coffee.
Right here is the perrfect web sitee ffor anybbody who really wants to find ouut about tyis topic.
You realie a whole lot its almost harrd to argue with yyou (not that I actually wilol
need to…HaHa). Yoou certaainly put a brand nnew spin onn a subject that's bewn discussed
for ages. Wonderful stuff, just wonderful!
Can I simply juzt sayy whatt a relief to discover someone who genuknely knows whhat hey are talking about ovsr the internet.
You achtually know howw tto brikng a prtoblem too light and mak iit important.
More andd morde people must read this and
understandd this side oof the story. I was surprisrd tyat you aren't mkre popjlar given that you surely possesxs the gift.
Heey I know this iis ooff topic butt I waas wondering iff you knew oof any widgets I could aadd tto my blog that automatically tweet my newest twitter updates.
I've been looking for a plug-in like tuis for quite some time and wass hoping maytbe you would haave somje experience with somethibg luke this.
Please let me kbow if you runn imto anything.
I truly enjoy reading your blog and I look forwardd to your nnew updates.
Wonderful blog! I ffound it while surfing arouynd onn Yahoo News.
Do you have any suggestions on how tto get listed
in Yaoo News? I've beenn trrying ffor a while but I never seem to get there!
Thanks
Howdy! I know this iis kinda off topic but I waas wonering if you knew where
I coud fimd a captcha plugin for myy comment form?
I'm uusing tthe same blolg platform as yours and I'm haviung problems
finding one? Thanks a lot!
Terrific paintings! That is the kind of information that are supposed to be shared across the internet. Shame on Google for no longer positioning this submit higher! Come on over and seek advice from my web site . Thank you =)
Howdy! I could have sworn I've visited yojr blog before buut affter looking
at somee oof the atticles I realized it's new to me. Anyways, I'mcertainly pleassed I discovered it and I'll bbe book-marking it and checking bacck often!
Thans in favir of sharing such a fastidious thinking, artiicle iis nice, thqts why i have read
it completely