0
点赞
收藏
分享

微信扫一扫

Nginx管理脚本;Tomcat管理脚本

松鼠树屋 2022-10-09 阅读 82

#!/bin/bash

#Nginx_auto_install

#支持多实例虚拟主机添加

if [ $* -eq 0];then

echo -e \033[32m 请输入域名:{​​www.aaa.com|www.bbb.com​​}\033[0m

exit 1

fi

if [ ! "rpm -qa nginx" ];then

       yum install nginx -y

       nginx 

fi

if [ ! -d /etc/nginx/vhost ];then

mkdir /etc/nginx/vhost

sed -i 's/default.d/vhost/g' /etc/nginx/nginx.conf

fi

for i in $*

do

cat>/usr/local/nginx/vhost/$i.conf<<-EOF

server {  

       listen 80;

       server_name $i;

       location / {  

       root /usr/local/nginx/html/$i;

       index index.html index.htm;

        }  

}

EOF

mkdir -p /usr/local/nginx/html/$i

cat>/usr/local/nginx/html/$i/index.html<<-EOF

$i tset pages.

EOF

nginx -s reload

done

--------------------------------------------------------------------------

#!/bin/bash

#tomcat_auto_install

#支持任意多个Tomcat实例部署;支持将Tomcat加入Nginx均衡池









举报

相关推荐

0 条评论