Linux下nginx一键安装shell脚本
先从下载init.d.nginx启动文件到当前目录,修改程序安装目录
#!/bin/bashPATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/binexport PATH# Check if user is rootif [ $(id -u) != "0" ]; then echo "Error: You must be root to run this script, please use root to install this shell script" exit 1figroupadd wwwuseradd -s /sbin/nologin -g www wwwwget ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-8.21.tar.gztar zxvf pcre-8.21.tar.gzcd pcre-8.21/./configuremake && make installcd ../ldconfigwget http://nginx.org/download/nginx-1.2.7.tar.gztar zxvf nginx-1.2.7.tar.gzcd nginx-1.2.7/./configure --user=www --group=www --prefix=/usr/local/nginx --with-http_stub_status_module --with-http_ssl_module --with-http_gzip_static_module --with-ipv6make && make installcd ../cp init.d.nginx /etc/init.d/nginxchmod +x /etc/init.d/nginxchkconfig --level 345 nginx on/etc/init.d/nginx startps aux |grep nginx