V2ray搭建
1.云主机
腾讯云购买香港节点(过程略)
2.域名证书
准备域名(无需备案)、SSL证书(Nginx版)
3.Nginx配置
yum install epel-release
yum install nginx
vim /etc/nginx/conf.d/mysite.conf
mysite.conf
server {
listen 80;
server_name its.newmorning.work; # 域名
rewrite ^(.*) https://$server_name$1 permanent; # 强制跳转HTTPS
}
server {
listen 443 ssl http2;
server_name its.newmorning.work;
charset utf-8;
# ssl配置
ssl_protocols TLSv1.2 TLSv1.3; # tls 1.3要求nginx 1.13.0及以上版本
ssl_ciphers ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:DHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384;
ssl_prefer_server_ciphers off;
ssl_session_cache shared:SSL:10m;
ssl_session_timeout 1d;
ssl_session_tickets off;
ssl_certificate /root/ssl_cert_file/8025240_its.newmorning.work.pem; # 证书
ssl_certificate_key /root/ssl_cert_file/8025240_its.newmorning.work.key; # 证书密钥
access_log /var/log/nginx/mysite.access.log;
error_log /var/log/nginx/mysite.error.log;
root /usr/share/nginx/html;
location / {
index index.html;
}
location /PWNKjQgy { # 与 V2Ray 配置中的 path 保持一致
proxy_redirect off;
proxy_pass http://127.0.0.1:58711; # 假设v2ray的监听地址是12345
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
}
测试配置
nginx -t
启动nginx
systemctl start nginx
访问80和443端口验证是否有效
4.V2ray服务端
source <(curl -sL https://multi.netlify.app/v2ray.sh) --zh
[root@VM-4-8-centos ~]# v2ray
欢迎使用 v2ray 管理程序
1.服务管理 2.用户管理
3.更改配置 4.查看配置
5.全局功能 6.更新V2ray
7.生成客户端配置文件
更改配置->更改传输方式->websocket—>获取伪装路径—>更新到nginx配置中
更改配置->更改TLS设置->设置证书、域名
重启v2ray->查看配置->复制vmessURL
5.V2rayN客户端
通过URL导入配置,检测真实延迟(浏览器不能使用任何代理插件)