Welcome to Elvin's blog

nginx编译安装

nginx编译安装

#centos 6

#!/bin/sh
#centos 6
echo '#nginx编译安装'

#目录
Sdir=/it/tools  #定义下载目录
NGdir=/www/server/nginx #定义安装目录
[ ! -d $Sdir ]  && mkdir -p $Sdir
[ ! -d $NGdir ] && mkdir -p $NGdir

echo '#安装需要的库'
yum install gcc gcc-c++ -y
yum install pcre pcre-devel zlib* openssl* -y

echo '#添加用户'
useradd nginx -s /sbin/nologin -M 
id nginx

echo '#下载ngnix'
cd $Sdir
wget http://nginx.org/download/nginx-1.12.1.tar.gz 
tar -zxf nginx-*.tar.gz
cd nginx-*

echo '#编译安装'
./configure --prefix=$NGdir \
--user=nginx --group=nginx \
--with-http_ssl_module \
--with-http_stub_status_module 
make && make install 
#make clean && make distclean
echo $NGdir
ls -l $NGdir
$NGdir/sbin/nginx -V

echo '#启动ngnix'
$NGdir/sbin/nginx
echo '#查看启动'
netstat -antp|grep nginx 
echo  
ps -ef|grep nginx|grep -v grep
#

 

posted @ 2017-11-02 22:31  blog-elvin-vip  阅读(194)  评论(0编辑  收藏  举报