LNMP

nginx中文官方文档

安装nginx

脚本:

#!/bin/bash
#定义颜色函数
color(){
echo -e "\033[32m$1\033[0m"
}
color 此脚本用于安装或卸载nginx
read -p "请选择安装还是卸载nginx(1.安装|2.卸载):" x
case $x in
1)
wget http://nginx.org/download/nginx-1.20.2.tar.gz
tar -xf nginx-1.20.2.tar.gz
yum -y install gcc make pcre-devel openssl-devel &> /dev/null
[ $? -ne 0 ] && color 依赖包未安装成功
cd nginx-1.20.2/
./configure &> /dev/null && make &> /dev/null && make install &> /dev/null
[ $? -eq 0 ] && color nginx已安装
/usr/local/nginx/sbin/nginx
netstat -ntulp | grep -q nginx
[ $? -eq 0 ] && color nginx服务已启动;;
2)
/usr/local/nginx/sbin/nginx -s stop
netstat -ntulp | grep -q nginx
[ $? -ne 0 ] && color nginx服务已停止
#find / -name nginx -exec rm -rf {} \;
rm -rf /usr/local/nginx
[ $? -eq 0 ] && color nginx已卸载;;
*)
echo "请输入正确的选项(1.安装|2.卸载)"
esac
上一篇:SQLServer中的事务与锁


下一篇:docker(六)——构建lnmp