[shell]代码库
#!/bin/bash
#自动安装nginx 1.2.8 stable脚本
#仅为搭建测试环境使用,CentOS6测试通过
#by 纸鸢
WARNING () {
echo -e "\033[0;31;1m$*\033[0m\n"
}
#创建nginx专用用户
useradd -s /sbin/nologin -M www
WARNING "安装nginx依赖包"
yum install pcre-devel openssl-devel perl-ExtUtils-Embed wget -y
WARNING "开始下载安装nginx"
wget http://nginx.org/download/nginx-1.2.8.tar.gz
tar -zxvf nginx-1.2.8.tar.gz
cd nginx-1.2.8/
./configure --prefix=/usr/local/nginx --user=www --group=www --with-http_ssl_module --with-http_gzip_static_module --without-http_uwsgi_module --without-http_scgi_module --without-http_upstream_ip_hash_module --with-http_perl_module --with-pcre
make && make install
WARNING "启动nginx服务"
/usr/local/nginx/sbin/nginx
WARNING "查看nginx进程"
ps aux |grep nginx |grep -v grep
WARNING "查看nginx监听端口"
netstat -lnpt |grep nginx
WARNING "安装脚本执行结束,使用愉快"
exit 0