nginx自動安裝腳本

#!/bin/bash

cur_dir=$(pwd)

useradd -s /sbin/nologin -r -M www


yum install -y make gcc gcc-c++ autoconf automake zlib zlib-devel openssl openssl-devel pcre pcre-devel wget

wget http://blog.offensive.cn/nginx/pcre-8.30.tar.bz2
wget http://blog.offensive.cn/nginx/nginx-1.0.14.tar.gz
wget http://blog.offensive.cn/nginx/libunwind-1.0.1.tar.gz
wget http://blog.offensive.cn/nginx/gperftools-2.0.tar.gz

cd $cur_dir
tar xvf pcre-8.30.tar.bz2
cd pcre-8.30
./configure
make
make install

cd $cur_dir
tar xvf libunwind-1.0.1.tar.gz
cd libunwind-1.0.1
CFLAGS=-fPIC ./configure
make CFLAGS=-fPIC
make CFLAGS=-fPIC install

cd $cur_dir
tar xvf gperftools-2.0.tar.gz
cd gperftools-2.0
./configure
make
make install
echo "/usr/local/lib" > /etc/ld.so.conf.d/usr_local_lib.conf
ldconfig

cd $cur_dir
tar xvf nginx-1.0.14.tar.gz
cd nginx-1.0.14
sed -i "/CFLAGS=\"\$CFLAGS -g\"/s/^/#&/" auto/cc/gcc
./configure \
--user=www \
--group=www \
--prefix=/usr/local/nginx \
--with-http_stub_status_module \
--with-google_perftools_module \
--with-http_ssl_module  \
--with-md5=/usr/lib \
--with-sha1=/usr/lib
make
make install


mkdir /tmp/tcmalloc
chmod 777 /tmp/tcmalloc

sed -i '/nginx.pid/a google_perftools_profiles /tmp/tcmalloc;' /usr/local/nginx/conf/nginx.conf

wget -c http://blog.offensive.cn/shell/nginx
chmod +x nginx
mv nginx /etc/init.d/
chkconfig --level 35 nginx on
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章