Nginx安装脚本:自动安装pcre、Nginx,并创建用户,安装完成后进行必要的测试。但是没有相关判断,需要后续优化:
#!/bin/sh ################################################ # This scripts is created by miaocbin # QQ:289303323 # blog:http://miaocbin.blog.51cto.com ################################################ # deploy online # # set the variable NGINX_TOOL_DIR=/home/$username/tools NGINX_VERSION=1.6.3 NGINX_INSTALL_DIR=/usr/local/nginx-$NGINX_VERSION NGINX_LN_DIR=/usr/local/nginx # create the dir for the software storage. mkdir -p $NGINX_TOOL_DIR cd $NGINX_TOOL_DIR echo "----- step 1. install pcre -----" [ ! -f pcre-8.36.tar.gz ] && wget ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-8.36.tar.gz tar xzf pcre-8.36.tar.gz cd pcre-8.36 ./configure make && make install cd ../ echo "----- step 2. add NGINX user -----" useradd nginx -s /sbin/nologin -M sleep 1 echo "----- step 3. download or upload NGINX software -----" [ ! -f nginx-${NGINX_VERSION}.tar.gz ] && wget http://nginx.org/download/nginx-${NGINX_VERSION}.tar.gz tar xzf nginx-${NGINX_VERSION}.tar.gz cd nginx-${NGINX_VERSION} ./configure --prefix=${NGINX_INSTALL_DIR} --user=nginx --group=nginx --with-http_ssl_module --with-http_stub_status_module make && make install ln -s ${NGINX_INSTALL_DIR} ${NGINX_LN_DIR} echo "----- step 4. run NGINX service -----" echo "/usr/local/lib" >> /etc/ld.so.conf ldconfig ${NGINX_LN_DIR}/sbin/nginx -t ${NGINX_LN_DIR}/sbin/nginx echo "----- step 5. check NGINX service -----" ps -ef |grep nginx echo ---------- lsof -i tcp:80 echo ---------- curl 127.0.0.1 echo "nginx is installed."
本文出自 “冷水泡茶” 博客,请务必保留此出处http://miaocbin.blog.51cto.com/689091/1660227
原文地址:http://miaocbin.blog.51cto.com/689091/1660227