mirror of https://github.com/wulabing/Xray_onekey
parent
e3de05695d
commit
ae757cc902
11
README.md
11
README.md
|
@ -1,6 +1,11 @@
|
|||
# V2Ray 基于 Nginx 的 vmess+ws+tls 一键安装脚本 (Use Path)
|
||||
|
||||
> 近期将适配Centos8,并处理 nginx 安装部分的 bug
|
||||
### 2019-10-17
|
||||
|
||||
> 建议遇到问题的用户重置系统后重新安装
|
||||
|
||||
* 变更 添加 Nginx systemd serverfile
|
||||
* 修复 又双叒叕尝试修复 Nginx 开机自启动问题
|
||||
|
||||
### 2019-10-16
|
||||
|
||||
|
@ -77,9 +82,9 @@ bash <(curl -L -s https://raw.githubusercontent.com/wulabing/V2Ray_ws-tls_bash_o
|
|||
|
||||
停止 V2ray:`systemctl stop v2ray`
|
||||
|
||||
启动 Nginx:`/etc/nginx/sbin/nginx`
|
||||
启动 Nginx:`systemctl start nginx`
|
||||
|
||||
停止 Nginx:`/etc/nginx/sbin/nginx -s stop`
|
||||
停止 Nginx:`systemctl stop nginx`
|
||||
|
||||
|
||||
(其他的应该不用我多说了吧 嘿嘿嘿)
|
||||
|
|
62
install.sh
62
install.sh
|
@ -4,7 +4,7 @@
|
|||
# System Request:Debian 9+/Ubuntu 18.04+/Centos 7+
|
||||
# Author: wulabing
|
||||
# Dscription: V2ray ws+tls onekey
|
||||
# Version: 5.0
|
||||
# Version: 5.1
|
||||
# email:wulabing@admin.com
|
||||
# Official document: www.v2ray.com
|
||||
#====================================================
|
||||
|
@ -305,7 +305,7 @@ domain_check(){
|
|||
echo -e "${OK} ${GreenBG} 域名dns解析IP 与 本机IP 匹配 ${Font}"
|
||||
sleep 2
|
||||
else
|
||||
echo -e "${Error} ${RedBG} 请确保域名添加了正确的 A 记录,否则将无法正常使用 V2ray(y/n)"
|
||||
echo -e "${Error} ${RedBG} 请确保域名添加了正确的 A 记录,否则将无法正常使用 V2ray"
|
||||
echo -e "${Error} ${RedBG} 域名dns解析IP 与 本机IP 不匹配 是否继续安装?(y/n)${Font}" && read install
|
||||
case $install in
|
||||
[yY][eE][sS]|[yY])
|
||||
|
@ -393,11 +393,10 @@ judge "Nginx 配置修改"
|
|||
|
||||
start_process_systemd(){
|
||||
### nginx服务在安装完成后会自动启动。需要通过restart或reload重新加载配置
|
||||
${nginx_dir}/sbin/nginx
|
||||
systemctl restart nginx
|
||||
judge "Nginx 启动"
|
||||
|
||||
sed -i '/nginx/d' /etc/rc.local
|
||||
echo "${nginx_dir}/sbin/nginx" >> /etc/rc.local
|
||||
systemctl enable nginx
|
||||
judge "设置 Nginx 开机自启"
|
||||
|
||||
systemctl restart v2ray
|
||||
|
@ -408,24 +407,24 @@ start_process_systemd(){
|
|||
}
|
||||
|
||||
#debian 系 9 10 适配
|
||||
rc_local_initialization(){
|
||||
if [[ -f /etc/rc.local ]];then
|
||||
chmod +x /etc/rc.local
|
||||
else
|
||||
touch /etc/rc.local && chmod +x /etc/rc.local
|
||||
echo "#!/bin/bash" >> /etc/rc.local
|
||||
systemctl start rc-local
|
||||
fi
|
||||
|
||||
judge "rc.local 配置"
|
||||
}
|
||||
#rc_local_initialization(){
|
||||
# if [[ -f /etc/rc.local ]];then
|
||||
# chmod +x /etc/rc.local
|
||||
# else
|
||||
# touch /etc/rc.local && chmod +x /etc/rc.local
|
||||
# echo "#!/bin/bash" >> /etc/rc.local
|
||||
# systemctl start rc-local
|
||||
# fi
|
||||
#
|
||||
# judge "rc.local 配置"
|
||||
#}
|
||||
acme_cron_update(){
|
||||
if [[ "${ID}" == "centos" ]];then
|
||||
sed -i "/acme.sh/c 0 0 * * 0 /etc/nginx/sbin/nginx -s stop && \"/root/.acme.sh\"/acme.sh --cron --home \"/root/.acme.sh\" \
|
||||
> /dev/null && /etc/nginx/sbin/nginx" /var/spool/cron/root
|
||||
sed -i "/acme.sh/c 0 0 * * 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 /etc/nginx/sbin/nginx -s stop && \"/root/.acme.sh\"/acme.sh --cron --home \"/root/.acme.sh\" \
|
||||
> /dev/null && /etc/nginx/sbin/nginx" /var/spool/cron/crontabs/root
|
||||
sed -i "/acme.sh/c 0 0 * * 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 计划任务更新"
|
||||
}
|
||||
|
@ -484,6 +483,26 @@ ssl_judge_and_install(){
|
|||
acme
|
||||
fi
|
||||
}
|
||||
nginx_systemd(){
|
||||
cat>/lib/systemd/system/nginx.service<<EOF
|
||||
[Unit]
|
||||
Description=The NGINX HTTP and reverse proxy server
|
||||
After=syslog.target network.target remote-fs.target nss-lookup.target
|
||||
|
||||
[Service]
|
||||
Type=forking
|
||||
ExecStartPre=/etc/nginx/sbin/nginx -t
|
||||
ExecStart=/etc/nginx/sbin/nginx
|
||||
ExecReload=/etc/nginx/sbin/nginx -s reload
|
||||
ExecStop=/bin/kill -s QUIT \$MAINPID
|
||||
PrivateTmp=true
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
EOF
|
||||
|
||||
judge "Nginx systemd ServerFile 添加"
|
||||
}
|
||||
main(){
|
||||
is_root
|
||||
check_system
|
||||
|
@ -502,9 +521,8 @@ main(){
|
|||
|
||||
#将证书生成放在最后,尽量避免多次尝试脚本从而造成的多次证书申请
|
||||
ssl_judge_and_install
|
||||
|
||||
nginx_systemd
|
||||
show_information
|
||||
rc_local_initialization
|
||||
start_process_systemd
|
||||
acme_cron_update
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue