Centos 7+宝塔+Xray(VLESS)+ws+tls
1、安装宝塔
当前使用版本为宝塔7.5.1
(https://www.bt.cn/bbs/thread-19376-1-1.html)
执行:yum install -y wget && wget -O install.sh http://download.bt.cn/install/install_6.0.sh && sh install.sh
2、安装Xray
当前使用版本为Xray1.3.0
(https://github.com/XTLS/Xray-install)
安装:bash -c "$(curl -L https://github.com/XTLS/Xray-install/raw/main/install-release.sh)" @ install
(卸载:bash -c "$(curl -L https://github.com/XTLS/Xray-install/raw/main/install-release.sh)" @ remove --purge
)
2.1、Xray相关目录
installed: /usr/local/bin/xray
installed: /usr/local/etc/xray/config.json
installed: /usr/local/share/xray/geoip.dat
installed: /usr/local/share/xray/geosite.dat
installed: /var/log/xray/access.log
installed: /var/log/xray/error.log
installed: /etc/systemd/system/xray.service
installed: /etc/systemd/system/[email protected]
3、配置宝塔
3.1、一键安装LNMP:
3.2、宝塔面板上添加虚拟机:ip.xxx.xyz
3.2.1 如下图:
3.3 申请SSL:
3.3.1如下图:
3.4 配置虚拟机Nginx
(在server最后的大括号前}添加以下内容)
#V2ray代理
location /abc123/ { # /abc123/为伪装目录
#如果不是websocket请求
if ( $http_upgrade != "websocket" ) {
rewrite ^/(.*)$ /;
}
proxy_redirect off;
proxy_pass http://127.0.0.1:12345; # 12345为Xray对应的端口
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_set_header Host $host;
proxy_read_timeout 300s;
# Show real IP in v2ray access. log
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
3.3.1、如下图:
4、配置Xray(VLESS)
Xray配置文件位置:/usr/local/etc/xray/config.json
{
"inbounds": [
{
"port": 12345,
"listen": "127.0.0.1",
"protocol": "vless",
"settings": {
"decryption": "none",
"clients": [
{
"id": "619f16e1-c052-4eed-9e0a-05b5d5f60e9d",
"level": 0
}
]
},
"streamSettings": {
"network": "ws",
"wsSettings": {
"path": "/abc123/"
}
}
}],
"outbounds": [{
"protocol": "freedom",
"settings":{}
}]
}
5、Xray服务端相关
启动:systemctl start xray
或 /usr/local/bin/xray run -config /usr/local/etc/xray/config.json
重启:systemctl restart xray
停止:systemctl stop xray
更新geoip.dat和geosite.dat:bash -c "$(curl -L https://github.com/XTLS/Xray-install/raw/main/install-release.sh)" @ install-geodata
随系统启动:systemctl enable xray
6、配置客户端
以windows使用v2rayN为例
6.1、添加VLESS服务器
6.2、配置如下图:
7、如无异常,则能正常使用。
7.1、如不能使用,检查服务端配置/usr/local/etc/xray/config.json及客户端配置是否一致。
7.1.1、有可能上述安装的软件版本都已更新。本方法可能失效。
很好啊,用你的方法可行,我用的宝塔国际版,就是有些细节自己调整了一下,感谢,我觉得有生产环境的,比回落靠谱
很好啊,用你的方法可行,我用的宝塔国际版,就是有些细节自己调整了一下,感谢,我觉得有生产环境的,比回落靠谱