conflict fixed

pull/355/head
wulabing 2019-11-27 16:58:11 +08:00
commit 1a1c28d58d
3 changed files with 147 additions and 120 deletions

80
CHANGELOG.md Normal file
View File

@ -0,0 +1,80 @@
## 2019-11-27
* 调整证书签发检测 从周日凌晨0点 至 周日凌晨3点
* 添加参数 boost 可以直接使用 四合一 bbr/锐速 脚本
* 调整参数 tls_modify 兼容 TLS1.1 按需选择
## 2019-11-26
> 本版本有可能解决 ws tls 的祖传断流玄学问题,如有需要请执行安装脚本进行更新
* TLS配置修改为支持1.2 1.3 可通过 tls_modify 选项切换
* 卸载功能支持 可通过 uninstall 选项卸载
## 2018-04-10
* vmess+http2 over tls 脚本更新
## 2018-04-08
v3.3.1Beta
* 安装依赖小幅调整
* Readme内容调整
## 2018-04-06
v3.3(Beta)
* 修复 Ubuntu 16.04/17.10 安装后的Nginx启动失败
* 修复 由于重复执行脚本导致的 Nginx 安装源的重复添加问题
* 修复 由于重复执行脚本导致的 Nginx 配置文件异常,从而导致 Nginx 启动失败的问题
* 修复 Nginx Ubuntu 源错误添加导致的 Nginx 版本问题
## 2018-04-03
V3.2(Beta)
* Nginx 版本更新至mainline版本
* Nginx 配置中添加 TLS1.3 http2
## 2018-03-26
V3.1(Beta)
* 1.去除无关的依赖
* 2.安装顺序变更SSL生成放在程序末尾
* 3.NGINX 安装版本统一为最新 stable 版本(为将来可能进行的 http2 及 tls1.3 适配做好准备,debian 源默认 NGINX 版本过低不支持 http2
## 2018-03-18
V3.0(Stable)
* 1.修复 Path 分流时访问特定的伪装 Path 时出现的 Bad Request 问题 统一为404 Not Found
## 2018-03-10
V3.0(beta)
* 1.部分功能进行代码重构
* 2.添加了 301 重定向,即 http 强制跳转 https
* 3.添加了 页面伪装(一个计算器程序)
* 4.伪装path 从原来的/ray/ 变为 随机生成
## 2018-03-05
V2.1.1(stable)
* 1.变更 检测到端口占用后尝试自动kill相关进程
* 2.尝试修复 GCE 默认纯净模板80端口占用问题等待更多反馈
## 2018-02-04
V2.1.1(stable)
* 1.变更 local_ip 判断方式,从 本地网卡获取 变更至 命令获取 公网IP。
* 1.修复 域名dns解析IP 与 本机IP 不匹配 误报问题
## 2018-01-28
v2.1.1(stable)
* 1.修复 缺乏 lsof 依赖导致的端口占用判断异常问题
## 2018-01-27
v2.1.1(stable
* 1.修复 部分机型因缺乏 crontab (计划任务)依赖导致的安装失败问题
* 2.完善 端口占用 判断
## 2017-12-06
V2.1stable
* 1.修复 Centos7 找不到 Nginx 安装包的问题
* 2.完善 SElinux 配置过程提醒标识
V2.0stable
* 1.增加 Centos7 系统支持
* 2.增加 自定义端口 和 自定义alterID
* 3.完善 安装所需依赖
* 4.修复 Ubuntu 系列系统版本判断异常导致的安装中断问题
* 5.修复 bug
V1.02beta
* 1.增加 系统判定目前打算仅支持带systemd的较新主流开发版系统
* 2.本机 IP 获取方式重构
## 2017-12-05
V1.01beta
* 1.完善 支持 Debian9
* 2.修复 由于 Debian9 默认未安装 net-tools 导致的本机ip判定错误
* 3.修复 bc 安装问题
* 4.增加 ip 判定不一致时继续安装的选项由于某些vps情况比较特殊判定到内网IP或本身网卡信息或公网ip与服务期内信息不一致等情况
V1.0beta
* 1.目前仅支持 Debian 8+ / Ubuntu 16.04+
* 2.逐渐完善中

132
README.md
View File

@ -1,42 +1,40 @@
# V2Ray 基于 Nginx 的 vmess+ws+tls 一键安装脚本 Use Path
## V2Ray 基于 Nginx 的 vmess+ws+tls 一键安装脚本
> 感谢 JetBrains 提供的非商业开源软件开发授权
> Thanks for non-commercial open source development authorization by JetBrains
### 注意事项
* 如果你不了解脚本中各项设置的具体含义,除域名外,请使用脚本提供的默认值
* 使用本脚本需要你拥有 Linux 基础及使用经验,了解计算机网络部分知识,计算机基础操作
* 目前支持Debian 9+ / Ubuntu 18.04+ / Centos7+ 部分Centos模板可能存在难以处理的编译问题建议遇到编译问题时请更换至其他系统模板
* telegram 交流群:https://t.me/wulabing_v2ray
* 群主仅提供极其有限的支持,如有问题可以询问群友
* 每周日的凌晨3点Nginx 会自动重启以配合证书的签发定时任务进行,在此期间,节点无法正常连接,预计持续时间为若干秒至两分钟
> telegram 交流群:https://t.me/wulabing_v2ray
### 更新日志
* 请查看 CHANGELOG.md
### 证书
> 如果你已经拥有了你所使用域名的证书文件,可以将 crt 和 key 文件命名为 v2ray.crt v2ray.key 放在 /data 目录下(若目录不存在请先建目录),请注意证书文件权限及证书有效期,自定义证书有效期过期后请自行续签
#### 如果你遇到 PC 端可用,手机不可用的情况,请将手机调至飞行模式后再取消飞行模式,然后尝试连接
### 2019-11-25
> 本版本有可能解决 ws tls 的祖传断流玄学问题,如有需要请执行安装脚本进行更新
* TLS配置修改为TLS1.3 only
* Nginx 开启 HTTP/2 (不过没什么用 websocket 依旧是HTTP/1.1)
### 使用自定义证书
将crt和key文件命名为v2ray.crt v2ray.key 放在 /data 目录下(若目录不存在请先建目录)
脚本支持自动生成 let's encrypted 证书有效期3个月理论上自动生成的证书支持自动续签自动续签功能有待检验
### 查看客户端配置
用户 家目录下的 v2ray_info.txt
推荐使用 `cat v2ray_info.txt` 查看
`cat ~/v2ray_info.txt`
### V2ray 简介
* V2Ray是一个优秀的开源网络代理工具可以帮助你畅爽体验互联网目前已经全平台支持Windows、Mac、Android、IOS、Linux等操作系统的使用。
* 本脚本的另一个分支版本Use Host地址 https://github.com/dylanbai8/V2Ray_ws-tls_Website_onekey 请根据需求进行选择 感谢作者 dylanbai8 的改进与维护
* ~~本脚本的另一个分支版本Use Host地址 https://github.com/dylanbai8/V2Ray_ws-tls_Website_onekey 请根据需求进行选择~~ 该作者可能已停止维护
* 本脚本为一键完全配置脚本,在所有流程正常运行完毕后,直接按照输出结果设置客户端即可使用
* 已安装的用户,当出现无法连接的情况时,请用户根据该文档更新 V2ray core
* 请注意:我们依然强烈建议你全方面的了解整个程序的工作流程及原理
### 目前支持Debian 9+ / Ubuntu 18.04+ / Centos7+
### 如果你选择使用 V2ray强烈建议你关闭并删除所有的 shadowsocksR 服务端,仅使用标准的 V2ray 三件套(原因请查看 Wiki
### 建议单服务器仅搭建单个代理
* 本脚本默认安装最新版本的V2ray core
* V2ray core 目前最新版本为 4.20(同时请注意客户端 core 的同步更新,需要保证客户端内核版本 >= 服务端内核版本)
* 由于新版本增加了 web 伪装,因此强烈建议使用默认的443端口作为连接端口
* 伪装内容是随便找的,内容与作者无关,可自行替换。
## V2ray core 更新方式
* V2ray core 目前最新版本为 4.21.3(同时请注意客户端 core 的同步更新,需要保证客户端内核版本 >= 服务端内核版本)
* 建议使用默认的443端口作为连接端口
* 伪装内容可自行替换。
### V2ray core 更新方式
执行:
`bash <(curl -L -s https://install.direct/go.sh)`
@ -44,18 +42,18 @@
* 如果为最新版本,会输出提示并停止安装。否则会自动更新
* 未来会将相关内容集成到本脚本中并进行交互式操作更新
## 注意事项
### 注意事项
* 推荐在纯净环境下使用本脚本如果你是新手请不要使用Centos系统。
* 在尝试本脚本确实可用之前,请不要将本程序应用于生产环境中。
* 该程序依赖 Nginx 实现相关功能,请使用 [LNMP](https://lnmp.org) 或其他类似携带 Nginx 脚本安装过 Nginx 的用户特别留意,使用本脚本可能会导致无法预知的错误(未测试,若存在,后续版本可能会处理本问题)。
* V2Ray 的部分功能依赖于系统时间请确保您使用V2RAY程序的系统 UTC 时间误差在三分钟之内,时区无关。
* 本 bash 依赖于 [V2ray 官方安装脚本](https://install.direct/go.sh) 及 [acme.sh](https://github.com/Neilpang/acme.sh) 工作。
* Centos 系统用户请预先在防火墙中放行程序相关端口默认80443
## 准备工作
### 准备工作
* 准备一个域名并将A记录添加好。
* [V2ray官方说明](https://www.v2ray.com/),了解 TLS WebSocket 及 V2ray 相关信息
* 安装好 curl
## 安装方式(不兼容,二选一)
### 安装/更新方式(二选一)
Vmess+websocket+TLS+Nginx+Website
```
bash <(curl -L -s https://raw.githubusercontent.com/wulabing/V2Ray_ws-tls_bash_onekey/master/install.sh) | tee v2ray_ins.log
@ -74,95 +72,17 @@ bash <(curl -L -s https://raw.githubusercontent.com/wulabing/V2Ray_ws-tls_bash_o
停止 Nginx`systemctl stop nginx`
(其他的应该不用我多说了吧 嘿嘿嘿)
### 相关目录
Web 目录:`/home/wwwroot/3DCEList`
V2ray 服务端配置:`/etc/v2ray/config.json`
V2ray 客户端配置: `执行安装时所在目录下的 v2ray_info.txt`
V2ray 客户端配置: `~/v2ray_info.txt`
Nginx 目录: `/etc/nginx`
证书目录: `/data/v2ray.key 和 /data/v2ray.crt`
### 更新说明
...
## 2018-04-10
* vmess+http2 over tls 脚本更新
## 2018-04-08
v3.3.1Beta
* 安装依赖小幅调整
* Readme内容调整
## 2018-04-06
v3.3(Beta)
* 修复 Ubuntu 16.04/17.10 安装后的Nginx启动失败
* 修复 由于重复执行脚本导致的 Nginx 安装源的重复添加问题
* 修复 由于重复执行脚本导致的 Nginx 配置文件异常,从而导致 Nginx 启动失败的问题
* 修复 Nginx Ubuntu 源错误添加导致的 Nginx 版本问题
## 2018-04-03
V3.2(Beta)
* Nginx 版本更新至mainline版本
* Nginx 配置中添加 TLS1.3 http2
## 2018-03-26
V3.1(Beta)
* 1.去除无关的依赖
* 2.安装顺序变更SSL生成放在程序末尾
* 3.NGINX 安装版本统一为最新 stable 版本(为将来可能进行的 http2 及 tls1.3 适配做好准备,debian 源默认 NGINX 版本过低不支持 http2
## 2018-03-18
V3.0(Stable)
* 1.修复 Path 分流时访问特定的伪装 Path 时出现的 Bad Request 问题 统一为404 Not Found
## 2018-03-10
V3.0(beta)
* 1.部分功能进行代码重构
* 2.添加了 301 重定向,即 http 强制跳转 https
* 3.添加了 页面伪装(一个计算器程序)
* 4.伪装path 从原来的/ray/ 变为 随机生成
## 2018-03-05
V2.1.1(stable)
* 1.变更 检测到端口占用后尝试自动kill相关进程
* 2.尝试修复 GCE 默认纯净模板80端口占用问题等待更多反馈
## 2018-02-04
V2.1.1(stable)
* 1.变更 local_ip 判断方式,从 本地网卡获取 变更至 命令获取 公网IP。
* 1.修复 域名dns解析IP 与 本机IP 不匹配 误报问题
## 2018-01-28
v2.1.1(stable)
* 1.修复 缺乏 lsof 依赖导致的端口占用判断异常问题
## 2018-01-27
v2.1.1(stable
* 1.修复 部分机型因缺乏 crontab (计划任务)依赖导致的安装失败问题
* 2.完善 端口占用 判断
## 2017-12-06
V2.1stable
* 1.修复 Centos7 找不到 Nginx 安装包的问题
* 2.完善 SElinux 配置过程提醒标识
V2.0stable
* 1.增加 Centos7 系统支持
* 2.增加 自定义端口 和 自定义alterID
* 3.完善 安装所需依赖
* 4.修复 Ubuntu 系列系统版本判断异常导致的安装中断问题
* 5.修复 bug
V1.02beta
* 1.增加 系统判定目前打算仅支持带systemd的较新主流开发版系统
* 2.本机 IP 获取方式重构
## 2017-12-05
V1.01beta
* 1.完善 支持 Debian9
* 2.修复 由于 Debian9 默认未安装 net-tools 导致的本机ip判定错误
* 3.修复 bc 安装问题
* 4.增加 ip 判定不一致时继续安装的选项由于某些vps情况比较特殊判定到内网IP或本身网卡信息或公网ip与服务期内信息不一致等情况
V1.0beta
* 1.目前仅支持 Debian 8+ / Ubuntu 16.04+
* 2.逐渐完善中
证书文件: `/data/v2ray.key 和 /data/v2ray.crt`

View File

@ -27,9 +27,14 @@ nginx_conf_dir="/etc/nginx/conf/conf.d"
v2ray_conf="${v2ray_conf_dir}/config.json"
nginx_conf="${nginx_conf_dir}/v2ray.conf"
nginx_dir="/etc/nginx"
web_dir="/home/wwwroot"
nginx_openssl_src="/usr/local/src"
v2ray_bin_file="/usr/bin/v2ray"
nginx_systemd_file="/lib/systemd/system/nginx.service"
v2ray_systemd_file="/etc/systemd/system/v2ray.service"
nginx_version="1.16.1"
openssl_version="1.1.1d"
#生成伪装路径
camouflage=`cat /dev/urandom | head -n 10 | md5sum | head -c 8`
@ -203,7 +208,7 @@ web_camouflage(){
##请注意 这里和LNMP脚本的默认路径冲突千万不要在安装了LNMP的环境下使用本脚本否则后果自负
rm -rf /home/wwwroot && mkdir -p /home/wwwroot && cd /home/wwwroot
git clone https://github.com/wulabing/3DCEList.git
judge "web 站点伪装"
judge "web 站点伪装"
}
v2ray_install(){
if [[ -d /root/v2ray ]];then
@ -216,7 +221,7 @@ v2ray_install(){
wget --no-check-certificate https://install.direct/go.sh
## wget http://install.direct/go.sh
if [[ -f go.sh ]];then
bash go.sh --force
judge "安装 V2ray"
@ -293,7 +298,7 @@ nginx_install(){
}
ssl_install(){
if [[ "${ID}" == "centos" ]];then
${INS} install socat nc -y
${INS} install socat nc -y
else
${INS} install socat netcat -y
fi
@ -318,11 +323,11 @@ domain_check(){
echo -e "${Error} ${RedBG} 域名dns解析IP 与 本机IP 不匹配 是否继续安装y/n${Font}" && read install
case $install in
[yY][eE][sS]|[yY])
echo -e "${GreenBG} 继续安装 ${Font}"
echo -e "${GreenBG} 继续安装 ${Font}"
sleep 2
;;
*)
echo -e "${RedBG} 安装终止 ${Font}"
echo -e "${RedBG} 安装终止 ${Font}"
exit 2
;;
esac
@ -378,7 +383,7 @@ nginx_conf_add(){
index index.html index.htm;
root /home/wwwroot/3DCEList;
error_page 400 = /400.html;
location /ray/
location /ray/
{
proxy_redirect off;
proxy_pass http://127.0.0.1:10000;
@ -431,10 +436,10 @@ start_process_systemd(){
#}
acme_cron_update(){
if [[ "${ID}" == "centos" ]];then
sed -i "/acme.sh/c 0 0 * * 0 systemctl stop nginx && \"/root/.acme.sh\"/acme.sh --cron --home \"/root/.acme.sh\" \
sed -i "/acme.sh/c 0 3 * * 0 systemctl stop nginx && \"/root/.acme.sh\"/acme.sh --cron --home \"/root/.acme.sh\" \
> /dev/null && systemctl start nginx" /var/spool/cron/root
else
sed -i "/acme.sh/c 0 0 * * 0 systemctl stop nginx && \"/root/.acme.sh\"/acme.sh --cron --home \"/root/.acme.sh\" \
sed -i "/acme.sh/c 0 3 * * 0 systemctl stop nginx && \"/root/.acme.sh\"/acme.sh --cron --home \"/root/.acme.sh\" \
> /dev/null && systemctl start nginx" /var/spool/cron/crontabs/root
fi
judge "cron 计划任务更新"
@ -496,7 +501,7 @@ ssl_judge_and_install(){
}
nginx_systemd(){
cat>/lib/systemd/system/nginx.service<<EOF
cat>$nginx_systemd_file<<EOF
[Unit]
Description=The NGINX HTTP and reverse proxy server
After=syslog.target network.target remote-fs.target nss-lookup.target
@ -520,16 +525,20 @@ judge "Nginx systemd ServerFile 添加"
tls_type(){
if [[ -f "/etc/nginx/sbin/nginx" ]] && [[ -f "$nginx_conf" ]];then
echo "请选择支持的 TLS 版本default:1:"
echo "1: TLS1.2 and TLS1.3"
echo "2: TLS1.3 only"
echo "1: TLS1.1 TLS1.2 and TLS1.3"
echo "2: TLS1.2 and TLS1.3"
echo "3: TLS1.3 only"
read -p "请输入:" tls_version
[[ -z ${tls_version} ]] && tls_version=1
if [[ $tls_version == 2 ]];then
[[ -z ${tls_version} ]] && tls_version=2
if [[ $tls_version == 3 ]];then
sed -i 's/ssl_protocols.*/ssl_protocols TLSv1.3;/' $nginx_conf
echo -e "${OK} ${GreenBG} 已切换至 TLS1.3 only ${Font}"
elif [[ $tls_version == 1 ]];then
sed -i 's/ssl_protocols.*/ssl_protocols TLSv1.1 TLSv1.2 TLSv1.3;/' $nginx_conf
echo -e "${OK} ${GreenBG} 已切换至 TLS1.1 TLS1.2 and TLS1.3 ${Font}"
else
sed -i 's/ssl_protocols.*/ssl_protocols TLSv1.2 TLSv1.3;/' $nginx_conf
echo -e "${OK} ${GreenBG} 已切换至TLS1.2 and TLS1.3 ${Font}"
echo -e "${OK} ${GreenBG} 已切换至 TLS1.2 and TLS1.3 ${Font}"
fi
systemctl restart nginx
judge "Nginx 重启"
@ -537,6 +546,15 @@ tls_type(){
echo -e "${Error} ${RedBG} Nginx 或 配置文件不存在,请正确安装脚本后执行${Font}"
fi
}
uninstall_all(){
[[ -f $nginx_systemd_file ]] && rm -f $nginx_systemd_file
[[ -f $v2ray_systemd_file ]] && rm -f $v2ray_systemd_file
[[ -d $v2ray_bin_file ]] && rm -rf $v2ray_bin_file
[[ -d $nginx_dir ]] && rm -rf $nginx_dir
[[ -d $v2ray_conf_dir ]] && rm -rf $v2ray_conf_dir
[[ -d $web_dir ]] && rm -rf $web_dir
echo -e "${OK} ${GreenBG} 已卸载SSL证书文件已保留 ${Font}"
}
main(){
is_root
check_system
@ -564,6 +582,15 @@ list(){
tls_modify)
tls_type
;;
uninstall)
uninstall_all
;;
crontab_modify)
acme_cron_update
;;
boost)
bash <(curl -L -s "https://raw.githubusercontent.com/chiakge/Linux-NetSpeed/master/tcp.sh")
;;
*)
main
;;