空话不多说,直接上呼吁和代码,不清楚的自行补课!
tar zxvf libunwind-1.1.tar.gz
cd libunwind-1.1/
CFLAGS=-fPIC ./configure
make CFLAGS=-fPIC && make CFLAGS=-fPIC install
/sbin/ldconfig
cd../
# 假如系统是64位的需要先安装上面的 libunwind 库,32位系统则不需要安装
# 32位系统,不需要安装 libunwind,可是必然要添加 –enable-frame-pointers参数
# 64位系统,不需要添加 –enable-frame-pointers参数
tar zxvf gperftools-2.4.tar.gz
cd gperftools-2.4/
./configure --enable-frame-pointers
make && make install
/sbin/ldconfig
cd../
# 在高CPU焦点数环境下安装
tar jxvf jemalloc-4.0.4.tar.bz2
cd jemalloc-4.0.4/
./configure
make && make install
cd../
if [ `getconf WORD_BIT`==32 ]&&[ `getconf LONG_BIT`==64 ];then
OS_BIT=64
else
OS_BIT=32
fi
if [ ! -f "/usr/local/lib/libjemalloc.so" ];then
if [ "$OS_BIT"=='64' ];then
ln -s /usr/local/lib/libjemalloc.so.2 /usr/lib64/libjemalloc.so.1
ln -s /usr/local/lib/libjemalloc.so.2 /usr/lib64/libjemalloc.so.2
else
ln -s /usr/local/lib/libjemalloc.so.2 /usr/lib/libjemalloc.so.1
ln -s /usr/local/lib/libjemalloc.so.2 /usr/lib/libjemalloc.so.2
fi
echo '/usr/local/lib' > /etc/ld.so.conf.d/local.conf
/sbin/ldconfig
echo "jemalloc moduleinstall successfully! "
else
echo "jemalloc installfailed, Please contact the author! "
fi
tar zxvf nginx-1.9.12.tar.gz
tar zxvf openssl-1.0.2e.tar.gz
cd nginx-1.9.12/
[-e /usr/local/lib/libtcmalloc.so ] && { je_tc_malloc=2; malloc_module="--with-google_perftools_module"; }
[-e /usr/local/lib/libjemalloc.so ] && { je_tc_malloc=1; malloc_module="--with-ld-opt='-ljemalloc'"; }
echo $malloc_module
./configure --user=www --group=www --prefix=/usr/local/nginx --with-ipv6 --with-http_gzip_static_module --with-http_v2_module --with-http_realip_module $malloc_module --with-http_stub_status_module --with-http_sub_module --with-http_flv_module --with-http_ssl_module --with-openssl=../openssl-1.0.2e
make && make install
/sbin/ldconfig
cd../
#建设Nginx设置文件,在/usr/local/nginx/conf/目次中建设nginx.conf文件:
rm -fr /usr/local/nginx/conf/nginx.conf
vi /usr/local/nginx/conf/nginx.conf
user www www;
# nginx 历程数,发起凭据CPU数目来指定,一般为它的倍数 (如,2个四核的CPU计为8)
# worker_processes 8;
# worker_cpu_affinity 00000001 00000010 00000100 00001000 0001000000100000 01000000 10000000;
# worker_processes 16;