1 - v2ray
相关站点:
博客1
wget https://raw.githubusercontent.com/v2fly/fhs-install-v2ray/master/install-release.sh sudo bash install-release.sh sudo vim /usr/local/etc/v2ray/config.json /usr/local/etc/v2ray/config.json 中inbounds.settings.clients.id /usr/local/etc/v2ray/config.json 中inbounds.streamSettings.wsSettings.path
{
"log": {
"access": "/var/log/v2ray/access.log",
"error": "/var/log/v2ray/error.log",
"loglevel": "warning"
},
"inbounds": [{
"port": 11055,
"protocol": "vmess",
"settings": {
"clients": [{
"id": "27848739-7e62-4138-9fd3-098a63964b6b",
"level": 1,
"alterId": 0
}
]
},
"streamSettings": {
"network": "ws",
"wsSettings": {
"path": "/tech"
}
}
}
],
"outbounds": [{
"protocol": "freedom"
}
]
}
# 编辑完此脚本后需要重启 v2ray
启动v2ray
sudo systemctl start v2ray sudo systemctl enable v2ray
停止v2ray
systemctl stop v2ray
重启v2ray
systemctl restart v2ray
卸载v2ray
systemctl stop v2ray rm -rf /etc/v2ray/
安装nginx
sudo apt install curl gnupg2 ca-certificates lsb-release ubuntu-keyring
curl https://nginx.org/keys/nginx_signing.key | gpg –dearmor
| sudo tee /usr/share/keyrings/nginx-archive-keyring.gpg >/dev/null
gpg –dry-run –quiet –no-keyring –import –import-options import-show /usr/share/keyrings/nginx-archive-keyring.gpg
echo “deb [signed-by=/usr/share/keyrings/nginx-archive-keyring.gpg]
http://nginx.org/packages/ubuntu lsb_release -cs nginx”
| sudo tee /etc/apt/sources.list.d/nginx.list
sudo apt update
sudo apt install nginx
配置一个域名例如 v2ray.debug.xxx.com.conf cd /etc/nginx/conf.d sudo cp defult.conf v2ray.debug.xxx.com.conf sudo vim v2ray.debug.xxx.com.conf
把 server_name 配置为 v2ray.debug.xxx.com; location / { root /data/html/v2raytry; # 这个路径(其他路径也可以)下新建index.html 写入内容例如
Hello World!
index index.html index.htm; }此时重启nginx,并访问v2ray.debug.xxx.com 浏览器访问会回显 Hello World!
安装certbot并申请ssl证书
sudo apt install certbot python3-certbot-nginx sudo certbot –nginx 具体执行参考 certbot–nginx命令执行.jpg
等一会证书会自动安装好, 并自动修改选定域名的nginx配置 v2ray.debug.xxx.com.conf v2ray.debug.xxx.com.conf 类似于这样 server{ server_name v1.v2ray.debug.xxx.com; index index.html; root /root/www/;
listen 443 ssl; # managed by Certbot
ssl_certificate /etc/letsencrypt/live/v1.xxxx.com/fullchain.pem; # managed by Certbot
ssl_certificate_key /etc/letsencrypt/live/v1.xxxx.com/privkey.pem; # managed by Certbot
include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot
} server{ if ($host = v2ray.debug.xxx.com) { return 301 https://$host$request_uri; } # managed by Certbot
listen 80;
server_name v1.xxxx.com;
return 404; # managed by Certbot
}
修改v2ray.debug.xxx.com.conf 并添加
添加这部分内容, 11055 对应/usr/local/etc/v2ray/config.json 里面inbounds端口
/tech客户端配置的时候需要,对应/usr/local/etc/v2ray/config.json streamSettings里的path
location /tech { proxy_redirect off; proxy_pass http://127.0.0.1:11055; proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection “upgrade”; proxy_set_header Host $http_host; } 最终配置文件为 server { server_name v2ray.debug.xxx.com;
#access_log /var/log/nginx/host.access.log main;
location / {
root /data/html/v2raytry;
index index.html index.htm;
}
## 添加这部分内容,22055对应/usr/local/etc/v2ray/config.json 里面inbounds端口
## /tech客户端配置的时候需要,对应/usr/local/etc/v2ray/config.json streamSettings里的path
location /tech {
proxy_redirect off;
proxy_pass http://127.0.0.1:11055;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_set_header Host $http_host;
}
#error_page 404 /404.html;
# redirect server error pages to the static page /50x.html
#
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/html;
}
# proxy the PHP scripts to Apache listening on 127.0.0.1:80
#
#location ~ \.php$ {
# proxy_pass http://127.0.0.1;
#}
# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
#
#location ~ \.php$ {
# root html;
# fastcgi_pass 127.0.0.1:9000;
# fastcgi_index index.php;
# fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name;
# include fastcgi_params;
#}
# deny access to .htaccess files, if Apache's document root
# concurs with nginx's one
#
#location ~ /\.ht {
# deny all;
#}
listen 443 ssl; # managed by Certbot
ssl_certificate /etc/letsencrypt/live/v2ray.debug.xxx.com/fullchain.pem; # managed by Certbot
ssl_certificate_key /etc/letsencrypt/live/v2ray.debug.xxx.com/privkey.pem; # managed by Certbot
include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot
}
server { if ($host = v2ray.debug.xxx.com) { return 301 https://$host$request_uri; } # managed by Certbot
listen 80;
server_name v2ray.debug.xxx.com;
return 404; # managed by Certbot
}
配置好后重启nginx,并访问v2ray.debug.xxx.com 浏览器访问会回显 Hello World!但此时已经事https访问了
v2ray客户端配置, 这里以windows为例 在6.27,版本中, 新建一个订阅分组,这里新建订阅分组的目的是, 如果你有其他机场,那么建议每个机场都单独定义一个订阅分组,所以这里是我们自己搭建的机场, 就新建一个v2ray.debug的分组
订阅分组–》订阅分组设置–》添加–》 设置一个别名 v2ray.debug 后确定 回到主界面, 选择刚才新建的分组 v2ray.debug 点一下, 服务器–》添加[VMess]服务器
服务器:v2fly 别名: v2ray.debu 这个可以随便鞋 地址: v2ray.debug.xxx.com 用户ID: /usr/local/etc/v2ray/config.json 中inbounds.settings.clients.id 这里是 27848739-7e62-4138-9fd3-098a63964b6b 加密方式: 默认 auto 传输协议: 默认tcp, 这里改成ws 伪装类型: none 伪装域名: v2ray.debug.xxx.com 路径(path): /usr/local/etc/v2ray/config.json 中inbounds.streamSettings.wsSettings.path 这里是 /tech 传输层安全(TLS): 选择tls SNI: 留空 Fingerprint:留空 Alpn: 留空 跳过证书验证(allowInsecure):选择false
最后确定保存, 之后就可以试试访问google.com youtube.com