整理自:
?
http://coralzd.blog.51cto.com/90341/709068
?
?
1:安装pcre
2: 安装gzip?
? ? ? ? yum install -y zlib-devel
3: 利用google-perftools来优化高并发条件下的nginx
? ? 3.1:首先需要先安装libunwind库
? ? ? ? wget http://download.savannah.gnu.org/releases/libunwind/libunwind-0.99.tar.gz
tar zxvf libunwind-0.99.tar.gz
cd libunwind-0.99/
? ? ? ? CFLAGS=-fPIC ./configure --prefix=/usr
make CFLAGS=-fPIC
make CFLAGS=-fPIC install
? ? ?3.2:安装google-perftools
? ? ? ? wget http://google-perftools.googlecode.com/files/google-perftools-1.7.tar.gz
tar xzvf google-perftools-1.7.tar.gz
cd google-perftools-1.7
然后开始配置:
(32位可以不添加--enable-frame-pointers)
./configure --prefix=/usr --enable-frame-pointers?
make -j4 && make install
?4:安装nginx
./configure --prefix=/usr/local/nginx --with-http_stub_status_module --without-http_fastcgi_module --without-http_proxy_module --without-http_upstream_ip_hash_module --without-http_autoindex_module --without-http_ssi_module ? --without-http_proxy_module --without-mail_pop3_module --without-mail_imap_module --without-mail_smtp_module --without-http_uwsgi_module --without-http_scgi_module ?--without-http_memcached_module --with-google_perftools_module?
make && make install
5:关联lib
在 /etc/ld.so.conf中加入/usr/local/lib这一行
否则启动nginx时报错:
error while loading shared libraries: xxx.so.0:cannot open shared object file: No such file or directory
?
6: /sbin/ldconfig ?重新加载lib使之生效。
?
?
7:启动:
/usr/local/nginx/sbin/nginx -c /usr/local/nginx/conf/nginx.conf
?
8:如果修改了conf文件执行
/usr/local/nginx/sbin/nginx -s ?reload ?重新加载conf文件即可生效
?
?
9:启动成功后查看进程:
ps -ef | grep nginx?