21世纪青少年健康上网基础教学
前言: 本文面向可以自行操作Linux系统并具有少量web技术知识的同学,非小白教学。更多的细节可以到官网文档中学习 www.v2ray.com
vps选择
vultr基本没法用了,尝试了一个马来西亚的服务商 gigsgigscloud.com。 非常垃圾,网络不稳定而且慢,换IP要6美刀,不推荐。
现在使用hostwinds.com,各方面的体验都不错,推荐。
2021-07-05 更新:
VPS强烈推荐 onevps : https://www.onevps.cloud/?aff=26018
已经用了一年,东京节点高速稳定
安装
采用 v2ray + nginx + tls 方式进行。以CentOS7为例。
- 先安装nginx。方便使用可以直接yum安装http://nginx.org/en/linux_packages.html
- 买一个域名,然后修改域名DNS,指向你的IP
- 启动nginx,然后直接访问ip,检测是否安装完成
- 安装certbot,安装官方文档,给域名下载证书等。https://certbot.eff.org/lets-encrypt/centosrhel7-nginx
certbot certonly --nginx
执行完成之后,会输出证书的路径,请自行记录。一般在/etc/letsencrypt/live/example.com/
对应域名的目录下。- 配置nginx。下面简单举一个例子
server {
listen 80;
server_name example.com; # 你的域名
rewrite ^(.*)$ https://$host$1 permanent; # rewirte到https
}
server {
listen 443 ssl;
server_name example.com;# 你的域名
root /usr/share/nginx/html;# 前台文件,直接用nginx默认的
index index.html index.htm;# 配合上面的前台文件配置
ssl_certificate /etc/letsencrypt/live/example.com/cert.pem;# 更换路径为 `certbot` 生成的内容
ssl_certificate_key /etc/letsencrypt/live/example.com/privkey.pem; # 更换路径为 `certbot` 生成的内容
ssl_session_timeout 5m; # 下面这些,没有特殊要求可以不动
ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:ECDHE:ECDH:AES:HIGH:!NULL:!aNULL:!MD5:!ADH:!RC4;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_prefer_server_ciphers on;
location / {
index index.html index.htm;
}
location /mengniusuansuanru { # 这个path,也需要对应v2ray的设置,可以自己设定
proxy_pass http://127.0.0.1:12315; # 这里的端口,为v2ray设置的端口,按需要进行配置
proxy_redirect off;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_set_header Host $http_host;
}
}
7.安装v2ray
# 一般系统中没有,需要另外安装
yum install -y unzip daemon curl
# 一键安装
bash <(curl -L -s https://install.direct/go.sh)
8.备份原来的v2ray默认设置,以防万一
cp /etc/v2ray/config.json /etc/v2ray/config.json.backup
9.修改配置 vim /etc/v2ray/config.json
。uuid 可以在这里弄一个https://www.uuidgenerator.net
{
"inbounds": [
{
"port": 12315,
"listen": "127.0.0.1",
"protocol": "vmess",
"settings": {
"clients": [
{
"id": "自己去弄一个id",
"alterId": 100
}
]
},
"streamSettings": {
"network": "ws",
"wsSettings": {
"path": "/mengniusuansuanru"
}
}
}
],
"outbounds": [
{
"protocol": "freedom",
"settings": {}
}
]
}
10.启动服务
# nginx 重启
nginx -s reload
# 启动v2ray
systemctl start v2ray
使用
客户端macos推荐使用v2rayU(https://github.com/yanue/V2rayU)。 安卓推荐使用kitsunebi。目前只有google play可以下载。因为你懂的原因,推荐另一个网站,可以下载google play上的apk : anzhiapp.com
本作品采用 知识共享署名-相同方式共享 4.0 国际许可协议 进行许可。
评论已关闭