代码拉取完成,页面将自动刷新
同步操作将从 cm@1149/lnmj 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
#!/bin/bash
. include/common.sh
clear
echo -e "${GREEN}
#####################################################################
# LNMP is a bash script for the installation of Nginx + PHP + MySQL.#
# Author Hehl <1181554113@qq.com> #
# Blog Http://www.cnblogs.com/ddif #
#####################################################################"
#Add vhost
vhost_add(){
echo -e "$YELLOW"
read -p "Please input your domain name as your htdoc! (example: yunweijilu.com) " domain_name
mkdir -p ${wwwroot_dir}/${domain_name}
chown -R $ngx_user:$ngx_group ${wwwroot_dir}/${domain_name}
cp -f conf/nginx_vhost.conf ${ngx_dir}/conf/vhost/${domain_name}.conf
sed -i "s/domain/${domain_name}/g" ${ngx_dir}/conf/vhost/${domain_name}.conf
nginx -s reload
echo -e "$GREEN"
[ -d ${wwwroot_dir}/${domain_name} ] && echo -e "Created ${wwwroot_dir}/${domain_name} success!"
[ -f ${ngx_dir}/conf/vhost/${domain_name}.conf ] && echo -e "Created ${ngx_dir}/conf/vhost/${domain_name}.conf success!"
}
#Delete vhost
vhost_del(){
echo -e "${YELLOW}"
read -p "Please input your domain name which you want delete! (example: yunweijilu.com) " domain_name
if [ -z "$domain_name" ];then
echo
echo -e "${WHITE}You did not intput anything."
elif [ -f ${ngx_dir}/conf/vhost/${domain_name}.conf ];then
[ ! -d ${data_backup_dir} ] && mkdir -p ${data_backup_dir}
mv ${wwwroot_dir}/${domain_name} ${data_backup_dir}/${domain_name}_`date +%m%d%H%M`
mv ${ngx_dir}/conf/vhost/${domain_name}.conf ${data_backup_dir}/${domain_name}.conf_`date +%m%d%H%M`
nginx -s reload
echo -e "$GREEN"
[ ! -d ${wwwroot_dir}/${domain_name} ] && echo -e "Delete ${wwwroot_dir}/${domain_name} success!"
[ ! -f ${ngx_dir}/conf/vhost/${domain_name}.conf ] && echo -e "Delete ${ngx_dir}/conf/vhost/${domain_name}.conf success!"
else
echo
echo -e "${RED}You input a incroccet domain name,Please check it..."
fi
}
#Vhost Menu
if [ ! -f ${ngx_dir}/conf/nginx.conf ];then
echo -e "${RED}Please check if you had installed Nginx!!"
else
if [[ "$1" == "add" && -z $2 ]];then
echo
vhost_add
elif [[ "$1" == "del" && -z $2 ]];then
echo
echo -e "${WHITE}You select delete vhost for nginx, your website data backup in $data_backup_dir"
vhost_del
else
echo
echo -e "${WHITE}Usage: $0 {add|del}"
fi
fi
echo -e "${WHITE}"
echo "################"
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。