delete web server(nginx+apache)

#!/bin/bash

conf_dir1="/usr/local/nginx/conf/vhost.d"
conf_dir2="/usr/local/apache2/conf/vhost.d"
rewrite_dir="/usr/local/nginx/conf/rewrite.d"
web_dir="/data/www/vhosts"

function dis_info {
        clear
        echo 
        echo "+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++"
        echo "Del Virtual Host"
        echo "++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++"
        echo
}
if [ $# -eq 0 ];then
	dis_info;
	echo "Pleast input domain:"
	read -p "(Default or Example domain: www.example.com):" domain ;
fi

if [ $# -eq 1 ];then
	domain=$1
fi

if [[ $domain == "" ]];then
        domain="example.com"
else if [[ $domain =~ ^www\.(.*)$ ]];then
        nonwww_domain=${domain#www.}
fi

fi

rm -rf $web_dir/$domain
rm -rf $conf_dir1/$domain.conf
rm -rf $conf_dir2/$domain.conf
rm -rf /data/www/logs/apache_log/access/${domain}_access.log*
rm -rf /data/www/logs/apache_log/error/${domain}_error.log*
rm -rf /data/www/logs/nginx_log/access/${domain}_access.log* 
rm -rf /data/www/logs/nginx_log/error/${domain}_error.log* 
rm -rf $rewrite_dir/$domain.conf


echo
echo "web site infomations:"
echo "========================================"
echo "domain list:$domain "
echo "----------------------------------------"
echo "website dir:$web_dir/$domain"
echo "----------------------------------------"
echo "nginx_conf file:$conf_dir1/$domain.conf"
echo "----------------------------------------"
echo "apache2_conf file:$conf_dir2/$domain.conf"
echo "----------------------------------------"

echo "Del web site is OK"
echo "========================================"

  

 

使用方法:

执行脚本,并传入要删除的网站域名作为参数

你可能感兴趣的:(delete web server(nginx+apache))