Nginx自动安装脚本
如下腳本為Nginx自動(dòng)安裝腳本,僅供參考,可以根據(jù)實(shí)際情況修改,這里使用case方式,真實(shí)環(huán)境安裝可以去掉case這種模式,全自動(dòng)安裝。
#!/bin/sh
###nginx install shell
###wugk 2012-12-12
###Define PATH ?定義變量
SOFT_PATH=/data/soft/
NGINX_FILE=nginx-1.2.4.tar.gz
DOWN_PATH=http://nginx.org/download/
#Define DIR and mkdir soft DIR ?創(chuàng)建軟件目錄
if
? ?[ ! -d $SOFT_PATH ];then
? ?mkdir -p $SOFT_PATH
fi
#Define download function ?定義download函數(shù)
download ()
{
? ?cd $SOFT_PATH ;wget $DOWN_PATH/$NGINX_FILE
}
#Define install function ? 定義install函數(shù)
install ()
{
? ?yum install pcre-devel -y
? ?cd $SOFT_PATH ;tar xzf $NGINX_FILE ?
? ?cd nginx-1.2.4/ &&./configure --prefix=/usr/local/nginx/ --with-http_stub_status_module --with-http_ssl_module
? ?[ $? -eq 0 ]&&make &&make install
}
#Start Nginx Server Define start function 定義start函數(shù)
start ()
{
? ?lsof -i :80
? [ $? -ne 0 ]&&/usr/local/nginx/sbin/nginx
}
#Stop Nginx Server Define stop function ? 定義stop函數(shù)
stop ()
{
ps -ef |grep nginx |grep -v grep |awk '{print $2}'|xargs kill -9
}
#Config Case menu install ?配置case 安裝菜單
case ?$1 ?in
? ?download )
? ?download
;;
? ?install )
? ?install
;;
? ?start )
? ?start
;;
? ?stop )
? ?stop
;;
? ? ?* )
? ?echo "USAGE:$0 {download or install or start or stop}"
? ?exit $?
esac
轉(zhuǎn)載于:https://blog.51cto.com/350906/1294087
創(chuàng)作挑戰(zhàn)賽新人創(chuàng)作獎(jiǎng)勵(lì)來(lái)咯,堅(jiān)持創(chuàng)作打卡瓜分現(xiàn)金大獎(jiǎng)總結(jié)
以上是生活随笔為你收集整理的Nginx自动安装脚本的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問(wèn)題。
- 上一篇: java连接sqlserver2008
- 下一篇: YAF分析(一)