mirror of https://github.com/wulabing/Xray_onekey
Nginx 逻辑修改bug处理
parent
8b674587f6
commit
7167b6907b
27
README.md
27
README.md
|
@ -7,32 +7,13 @@
|
||||||
> telegram 交流群:https://t.me/wulabing_v2ray
|
> telegram 交流群:https://t.me/wulabing_v2ray
|
||||||
|
|
||||||
#### 如果你遇到 PC 端可用,手机不可用的情况,请将手机调至飞行模式后再取消飞行模式,然后尝试连接
|
#### 如果你遇到 PC 端可用,手机不可用的情况,请将手机调至飞行模式后再取消飞行模式,然后尝试连接
|
||||||
### 2019-10-17
|
### 2019-11-24
|
||||||
|
|
||||||
> 建议遇到问题的用户重置系统后重新安装
|
* 更新 伪装页面从小游戏变更为3D元素周期表
|
||||||
|
* 更新 主版本代码合并至h2版本
|
||||||
|
* 优化 重复安装不会再次编译Nginx
|
||||||
|
|
||||||
|
|
||||||
* 变更 添加 Nginx systemd serverfile
|
|
||||||
* 修复 又双叒叕尝试修复 Nginx 开机自启动问题
|
|
||||||
|
|
||||||
### 2019-10-16
|
|
||||||
|
|
||||||
* 适配 Centos8 Debian10 Ubuntu19.04
|
|
||||||
* 修复 部分系统下 计划任务不生效的问题
|
|
||||||
* 修复 时间同步服务 在 Centos8 下无法安装的错误
|
|
||||||
* 修复 部分系统下 证书不会自动更新的问题
|
|
||||||
* 修复 部分系统下 Nginx 开机自启配置失效的问题
|
|
||||||
* 变更 重复安装时,将不对相同的域名进行重复的证书申请,防止出现 Let's encrypt API 次数限制
|
|
||||||
* 变更 默认 alterID 64 -> 4 ,减少资源占用
|
|
||||||
* 变更 nginx 安装方式从源获取 变更为 编译安装,并使用新版Openssl,支持tls1.3
|
|
||||||
* 变更 nginx 配置文件 ssl_protocols ssl_ciphers,适配 tls1.3
|
|
||||||
* 变更 取消对Debian8 Ubuntu 16.04 的适配工作(本版本可能依旧可用)
|
|
||||||
* 变更 默认页面伪装为 html5 小游戏
|
|
||||||
* 新增 安装完成,节点配置信息留档
|
|
||||||
* 新增 使用自定义证书
|
|
||||||
* 新增 链接方式导入导入
|
|
||||||
* 新增 二维码方式导入
|
|
||||||
|
|
||||||
### 使用自定义证书
|
### 使用自定义证书
|
||||||
将crt和key文件命名为v2ray.crt v2ray.key 放在 /data 目录下(若目录不存在请先建目录)
|
将crt和key文件命名为v2ray.crt v2ray.key 放在 /data 目录下(若目录不存在请先建目录)
|
||||||
|
|
||||||
|
|
|
@ -441,7 +441,7 @@ acme_cron_update(){
|
||||||
|
|
||||||
vmess_qr_config(){
|
vmess_qr_config(){
|
||||||
cat >/etc/v2ray/vmess_qr.json <<-EOF
|
cat >/etc/v2ray/vmess_qr.json <<-EOF
|
||||||
{
|
{
|
||||||
"v": "2",
|
"v": "2",
|
||||||
"ps": "wulabing_${domain}",
|
"ps": "wulabing_${domain}",
|
||||||
"add": "${domain}",
|
"add": "${domain}",
|
||||||
|
@ -453,7 +453,7 @@ vmess_qr_config(){
|
||||||
"host": "${domain}",
|
"host": "${domain}",
|
||||||
"path": "/${camouflage}/",
|
"path": "/${camouflage}/",
|
||||||
"tls": "tls"
|
"tls": "tls"
|
||||||
}
|
}
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
vmess_link="vmess://$(cat /etc/v2ray/vmess_qr.json | base64 -w 0)"
|
vmess_link="vmess://$(cat /etc/v2ray/vmess_qr.json | base64 -w 0)"
|
||||||
|
|
201
install_h2.sh
201
install_h2.sh
|
@ -35,22 +35,27 @@ source /etc/os-release
|
||||||
VERSION=`echo ${VERSION} | awk -F "[()]" '{print $2}'`
|
VERSION=`echo ${VERSION} | awk -F "[()]" '{print $2}'`
|
||||||
|
|
||||||
check_system(){
|
check_system(){
|
||||||
|
|
||||||
if [[ "${ID}" == "centos" && ${VERSION_ID} -ge 7 ]];then
|
if [[ "${ID}" == "centos" && ${VERSION_ID} -ge 7 ]];then
|
||||||
echo -e "${OK} ${GreenBG} 当前系统为 Centos ${VERSION_ID} ${VERSION} ${Font} "
|
echo -e "${OK} ${GreenBG} 当前系统为 Centos ${VERSION_ID} ${VERSION} ${Font}"
|
||||||
INS="yum"
|
INS="yum"
|
||||||
elif [[ "${ID}" == "debian" && ${VERSION_ID} -ge 8 ]];then
|
elif [[ "${ID}" == "debian" && ${VERSION_ID} -ge 8 ]];then
|
||||||
echo -e "${OK} ${GreenBG} 当前系统为 Debian ${VERSION_ID} ${VERSION} ${Font} "
|
echo -e "${OK} ${GreenBG} 当前系统为 Debian ${VERSION_ID} ${VERSION} ${Font}"
|
||||||
INS="apt"
|
INS="apt"
|
||||||
|
$INS update
|
||||||
|
## 添加 Nginx apt源
|
||||||
elif [[ "${ID}" == "ubuntu" && `echo "${VERSION_ID}" | cut -d '.' -f1` -ge 16 ]];then
|
elif [[ "${ID}" == "ubuntu" && `echo "${VERSION_ID}" | cut -d '.' -f1` -ge 16 ]];then
|
||||||
echo -e "${OK} ${GreenBG} 当前系统为 Ubuntu ${VERSION_ID} ${VERSION_CODENAME} ${Font} "
|
echo -e "${OK} ${GreenBG} 当前系统为 Ubuntu ${VERSION_ID} ${UBUNTU_CODENAME} ${Font}"
|
||||||
INS="apt"
|
INS="apt"
|
||||||
|
$INS update
|
||||||
else
|
else
|
||||||
echo -e "${Error} ${RedBG} 当前系统为 ${ID} ${VERSION_ID} 不在支持的系统列表内,安装中断 ${Font} "
|
echo -e "${Error} ${RedBG} 当前系统为 ${ID} ${VERSION_ID} 不在支持的系统列表内,安装中断 ${Font}"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
systemctl stop firewalld && systemctl disable firewalld
|
||||||
|
echo -e "${OK} ${GreenBG} firewalld 已关闭 ${Font}"
|
||||||
}
|
}
|
||||||
|
|
||||||
is_root(){
|
is_root(){
|
||||||
if [ `id -u` == 0 ]
|
if [ `id -u` == 0 ]
|
||||||
then echo -e "${OK} ${GreenBG} 当前用户是root用户,进入安装流程 ${Font} "
|
then echo -e "${OK} ${GreenBG} 当前用户是root用户,进入安装流程 ${Font} "
|
||||||
|
@ -69,51 +74,106 @@ judge(){
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
ntpdate_install(){
|
|
||||||
|
# 旧版本遗弃代码
|
||||||
|
|
||||||
|
#ntpdate_install(){
|
||||||
|
# if [[ "${ID}" == "centos" ]];then
|
||||||
|
# ${INS} install ntpdate -y
|
||||||
|
# else
|
||||||
|
# ${INS} update
|
||||||
|
# ${INS} install ntpdate -y
|
||||||
|
# fi
|
||||||
|
# judge "安装 NTPdate 时间同步服务 "
|
||||||
|
#}
|
||||||
|
#time_modify(){
|
||||||
|
#
|
||||||
|
# ntpdate_install
|
||||||
|
#
|
||||||
|
# systemctl stop ntp &>/dev/null
|
||||||
|
#
|
||||||
|
# echo -e "${Info} ${GreenBG} 正在进行时间同步 ${Font}"
|
||||||
|
# ntpdate time.nist.gov
|
||||||
|
#
|
||||||
|
# if [[ $? -eq 0 ]];then
|
||||||
|
# echo -e "${OK} ${GreenBG} 时间同步成功 ${Font}"
|
||||||
|
# echo -e "${OK} ${GreenBG} 当前系统时间 `date -R`(请注意时区间时间换算,换算后时间误差应为三分钟以内)${Font}"
|
||||||
|
# sleep 1
|
||||||
|
# else
|
||||||
|
# echo -e "${Error} ${RedBG} 时间同步失败,请检查ntpdate服务是否正常工作 ${Font}"
|
||||||
|
# fi
|
||||||
|
#}
|
||||||
|
|
||||||
|
chrony_install(){
|
||||||
|
${INS} -y install chrony
|
||||||
|
judge "安装 chrony 时间同步服务 "
|
||||||
|
|
||||||
|
timedatectl set-ntp true
|
||||||
|
|
||||||
if [[ "${ID}" == "centos" ]];then
|
if [[ "${ID}" == "centos" ]];then
|
||||||
${INS} install ntpdate -y
|
systemctl enable chronyd && systemctl restart chronyd
|
||||||
else
|
else
|
||||||
${INS} update
|
systemctl enable chrony && systemctl restart chrony
|
||||||
${INS} install ntpdate -y
|
|
||||||
fi
|
fi
|
||||||
judge "安装 NTPdate 时间同步服务 "
|
|
||||||
|
judge "chronyd 启动 "
|
||||||
|
|
||||||
|
timedatectl set-timezone Asia/Shanghai
|
||||||
|
|
||||||
|
echo -e "${OK} ${GreenBG} 等待时间同步 ${Font}"
|
||||||
|
sleep 10
|
||||||
|
|
||||||
|
chronyc sourcestats -v
|
||||||
|
chronyc tracking -v
|
||||||
|
date
|
||||||
|
read -p "请确认时间是否准确,误差范围±3分钟(Y/N): " chrony_install
|
||||||
|
[[ -z ${chrony_install} ]] && chrony_install="Y"
|
||||||
|
case $chrony_install in
|
||||||
|
[yY][eE][sS]|[yY])
|
||||||
|
echo -e "${GreenBG} 继续安装 ${Font}"
|
||||||
|
sleep 2
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
echo -e "${RedBG} 安装终止 ${Font}"
|
||||||
|
exit 2
|
||||||
|
;;
|
||||||
|
esac
|
||||||
}
|
}
|
||||||
time_modify(){
|
|
||||||
|
|
||||||
ntpdate_install
|
|
||||||
|
|
||||||
systemctl stop ntp &>/dev/null
|
|
||||||
|
|
||||||
echo -e "${Info} ${GreenBG} 正在进行时间同步 ${Font}"
|
|
||||||
ntpdate time.nist.gov
|
|
||||||
|
|
||||||
if [[ $? -eq 0 ]];then
|
|
||||||
echo -e "${OK} ${GreenBG} 时间同步成功 ${Font}"
|
|
||||||
echo -e "${OK} ${GreenBG} 当前系统时间 `date -R`(请注意时区间时间换算,换算后时间误差应为三分钟以内)${Font}"
|
|
||||||
sleep 1
|
|
||||||
else
|
|
||||||
echo -e "${Error} ${RedBG} 时间同步失败,请检查ntpdate服务是否正常工作 ${Font}"
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
dependency_install(){
|
dependency_install(){
|
||||||
${INS} install wget lsof -y
|
${INS} install wget git lsof -y
|
||||||
|
|
||||||
if [[ "${ID}" == "centos" ]];then
|
if [[ "${ID}" == "centos" ]];then
|
||||||
${INS} -y install crontabs
|
${INS} -y install crontabs
|
||||||
else
|
else
|
||||||
${INS} install cron
|
${INS} -y install cron
|
||||||
fi
|
fi
|
||||||
judge "安装 crontab"
|
judge "安装 crontab"
|
||||||
|
|
||||||
# 新版的IP判定不需要使用net-tools
|
if [[ "${ID}" == "centos" ]];then
|
||||||
# ${INS} install net-tools -y
|
touch /var/spool/cron/root && chmod 600 /var/spool/cron/root
|
||||||
# judge "安装 net-tools"
|
systemctl start crond && systemctl enable crond
|
||||||
|
else
|
||||||
|
touch /var/spool/cron/crontabs/root && chmod 600 /var/spool/cron/crontabs/root
|
||||||
|
systemctl start cron && systemctl enable cron
|
||||||
|
|
||||||
${INS} install bc -y
|
fi
|
||||||
|
judge "crontab 自启动配置 "
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
${INS} -y install bc
|
||||||
judge "安装 bc"
|
judge "安装 bc"
|
||||||
|
|
||||||
${INS} install unzip -y
|
${INS} -y install unzip
|
||||||
judge "安装 unzip"
|
judge "安装 unzip"
|
||||||
|
|
||||||
|
${INS} -y install qrencode
|
||||||
|
judge "安装 qrencode"
|
||||||
|
|
||||||
|
${INS} -y install dbus
|
||||||
|
judge "安装 dbus"
|
||||||
|
|
||||||
}
|
}
|
||||||
port_alterid_set(){
|
port_alterid_set(){
|
||||||
stty erase '^H' && read -p "请输入连接端口(default:443):" port
|
stty erase '^H' && read -p "请输入连接端口(default:443):" port
|
||||||
|
@ -220,8 +280,11 @@ acme(){
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
start_process_systemd(){
|
start_process_systemd(){
|
||||||
systemctl start v2ray
|
systemctl restart v2ray
|
||||||
judge "V2ray 启动"
|
judge "V2ray 启动"
|
||||||
|
|
||||||
|
systemctl enable v2ray
|
||||||
|
judge "设置 v2ray 开机自启"
|
||||||
}
|
}
|
||||||
|
|
||||||
v2ray_conf_add(){
|
v2ray_conf_add(){
|
||||||
|
@ -240,29 +303,67 @@ v2ray_conf_add(){
|
||||||
json_addr=`curl --upload-file ${client_conf} https://transfer.sh/wulabing_${camouflage}_${UUID}.json`
|
json_addr=`curl --upload-file ${client_conf} https://transfer.sh/wulabing_${camouflage}_${UUID}.json`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
vmess_qr_config(){
|
||||||
|
cat >/etc/v2ray/vmess_qr.json <<-EOF
|
||||||
|
{
|
||||||
|
"v": "2",
|
||||||
|
"ps": "wulabing_${domain}",
|
||||||
|
"add": "${domain}",
|
||||||
|
"port": "${port}",
|
||||||
|
"id": "${UUID}",
|
||||||
|
"aid": "${alterID}",
|
||||||
|
"net": "h2",
|
||||||
|
"type": "none",
|
||||||
|
"tls": "tls"
|
||||||
|
}
|
||||||
|
EOF
|
||||||
|
|
||||||
|
vmess_link="vmess://$(cat /etc/v2ray/vmess_qr.json | base64 -w 0)"
|
||||||
|
echo -e "${Red} URL导入链接:${vmess_link} ${Font}" >>./v2ray_info.txt
|
||||||
|
echo -e "${Red} 二维码: ${Font}" >>./v2ray_info.txt
|
||||||
|
echo "${vmess_link}"| qrencode -o - -t utf8 >>./v2ray_info.txt
|
||||||
|
}
|
||||||
|
|
||||||
show_information(){
|
show_information(){
|
||||||
clear
|
clear
|
||||||
|
|
||||||
echo -e "${OK} ${Green} V2ray http2 over tls 安装成功 "
|
echo -e "${OK} ${Green} V2ray http2 over tls 安装成功 " >./v2ray_info.txt
|
||||||
echo -e "${Red} V2ray 配置信息 ${Font}"
|
echo -e "${Red} V2ray 配置信息 ${Font}" >>./v2ray_info.txt
|
||||||
echo -e "${Red} 地址(address):${Font} ${domain} "
|
echo -e "${Red} 地址(address):${Font} ${domain} " >>./v2ray_info.txt
|
||||||
echo -e "${Red} 端口(port):${Font} ${port} "
|
echo -e "${Red} 端口(port):${Font} ${port} " >>./v2ray_info.txt
|
||||||
echo -e "${Red} 用户id(UUID):${Font} ${UUID}"
|
echo -e "${Red} 用户id(UUID):${Font} ${UUID}" >>./v2ray_info.txt
|
||||||
echo -e "${Red} 额外id(alterId):${Font} ${alterID}"
|
echo -e "${Red} 额外id(alterId):${Font} ${alterID}" >>./v2ray_info.txt
|
||||||
echo -e "${Red} 加密方式(security):${Font} 自适应 "
|
echo -e "${Red} 加密方式(security):${Font} 自适应 " >>./v2ray_info.txt
|
||||||
echo -e "${Red} 传输协议(network):${Font} h2 "
|
echo -e "${Red} 传输协议(network):${Font} h2 " >>./v2ray_info.txt
|
||||||
echo -e "${Red} 伪装类型(type):${Font} none "
|
echo -e "${Red} 伪装类型(type):${Font} none " >>./v2ray_info.txt
|
||||||
echo -e "${Red} 伪装域名(不要落下/):${Font} /${camouflage}/ "
|
echo -e "${Red} 伪装域名(不要落下/):${Font} /${camouflage}/ " >>./v2ray_info.txt
|
||||||
echo -e "${Red} 底层传输安全:${Font} tls "
|
echo -e "${Red} 底层传输安全:${Font} tls " >>./v2ray_info.txt
|
||||||
echo -e "${OK} ${GreenBG} 请注意,目前的GUI客户端(V2rayN)已经支持H2手动添加配置,当然您也可以通过 添加自定义配置 添加节点信息 ${Font}"
|
echo -e "${OK} ${GreenBG} 配置地址(方便下载): ${json_addr} ${Font}" >>./v2ray_info.txt
|
||||||
echo -e "${OK} ${GreenBG} 配置地址(方便下载): ${json_addr} ${Font}"
|
echo -e "${OK} ${GreenBG} 配置地址(服务器本地备份):/etc/v2ray/client.json ${Font}" >>./v2ray_info.txt
|
||||||
echo -e "${OK} ${GreenBG} 配置地址(服务器本地备份):/etc/v2ray/client.json ${Font}"
|
vmess_qr_config
|
||||||
|
cat ./v2ray_info.txt
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
ssl_judge_and_install(){
|
||||||
|
if [[ -f "/data/v2ray.key" && -f "/data/v2ray.crt" ]];then
|
||||||
|
echo "证书文件已存在"
|
||||||
|
elif [[ -f "~/.acme.sh/${domain}_ecc/${domain}.key" && -f "~/.acme.sh/${domain}_ecc/${domain}.cer" ]];then
|
||||||
|
echo "证书文件已存在"
|
||||||
|
~/.acme.sh/acme.sh --installcert -d ${domain} --fullchainpath /data/v2ray.crt --keypath /data/v2ray.key --ecc
|
||||||
|
judge "证书应用"
|
||||||
|
else
|
||||||
|
ssl_install
|
||||||
|
acme
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
main(){
|
main(){
|
||||||
is_root
|
is_root
|
||||||
check_system
|
check_system
|
||||||
time_modify
|
chrony_install
|
||||||
dependency_install
|
dependency_install
|
||||||
domain_check
|
domain_check
|
||||||
port_alterid_set
|
port_alterid_set
|
||||||
|
@ -271,7 +372,7 @@ main(){
|
||||||
v2ray_conf_add
|
v2ray_conf_add
|
||||||
|
|
||||||
#将证书生成放在最后,尽量避免多次尝试脚本从而造成的多次证书申请
|
#将证书生成放在最后,尽量避免多次尝试脚本从而造成的多次证书申请
|
||||||
ssl_install
|
ssl_judge_and_install
|
||||||
acme
|
acme
|
||||||
|
|
||||||
show_information
|
show_information
|
||||||
|
|
Loading…
Reference in New Issue