1安装nginx 的脚本
1)nginx 版本自己定义
2) 包在opt下
#!/bin/bash
#Nginx 安装脚本
#Nginx的源码包放在/root下
yum install gcc gcc-c++ pcre-devel zlib-devel openssl-devel -y &>/dev/null
useradd -M -s /sbin/nologin nginx
cd /opt && tar zxf nginx-1.12.0.tar.gz
cd /opt/nginx-1.12.0 && ./configure --user=nginx --group=nginx &>/dev/null && make &>/dev/null && make install &>/dev/null
if [ -f /usr/local/nginx/sbin/nginx ]
then
ln -s /usr/local/nginx/sbin/nginx /usr/local/sbin
fi
if [ "$?" -eq 0 ]
then
echo "Nginx安装成功" && /usr/local/nginx/sbin/nginx
else
echo "Nginx安装失败,请检查"
exit 1
fi
netstat -anpt | grep 80