码迷,mamicode.com
首页 > 系统相关 > 详细

nginx源码安装 shell编程

时间:2018-10-04 20:53:04      阅读:192      评论:0      收藏:0      [点我收藏+]

标签:function   Stub   span   status   show   .gz   Fix   dep   load   

#!/bin/bash
#--------------------------------------------------------
# Function: Install nginx for CentOS7
# Date: 2018-1-06
# Author: Anwar Wong
#--------------------------------------------------------
#Print debug information
 
NGINX_VER="$?"
NGINX_SOFT="nginx-${NGINX_VER}.tar.gz"
NGINX_URL="http://nginx.org/download"
NGINX_DIR="/usr/local/nginx"
NGINX_SRC=`echo $NGINX_SOFT| sed ‘s/.tar.*//g‘`
NGINX_YUM="yum install -y"
NGINX_ARG="--user=www --group=www --with-http_stub_status_module --with-http_ssl_module"
 
 
if [$? -eq 0]; then
      echo -e "\033[32m-----------------\033[0m"
echo -e "\033[32mUsage:{/bin/bash $0 1.2.3|1.12.2}\033[0m"
exit 0
fi
#Installing dependencies
$NGINX_YUM wget make tar gcc gcc-c++ glibc zlib zlib-devel 
$NGINX_YUM perl perl-devel pcre pcre-devel openssl openssl-devel
 
#Downloading
wget -c $NGINX_URL/$NGINX_SOFT
tar -xzf $NGINX_SOFT
cd $NGINX_SRC
 
#Creating user and group
useradd -s /sbin/nologin www
 
#Starting install nginx
./configure --prefix=$NGINX_DIR/$NGINX_ARG
 
#Compile nginx
make -j4
make -j4 install
 
#Starting Nginx
$NGINX_DIR/sbin/nginx
 
#Show nginx status
ps -ef |grep nginx
netstat -tnlp |grep nginx
 

nginx源码安装 shell编程

标签:function   Stub   span   status   show   .gz   Fix   dep   load   

原文地址:https://www.cnblogs.com/Anwar/p/9743305.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!