大家好我是钟义林,今天我们再来重新安装一个nginx服务吧,下面是安装过程,可以参考http://zhongyilin1990.blog.51cto.com/7786958/1287198 做个shell 来安装,当然,这只是一个安装的,我的环境是最小安装的。所以有些库和工具需要安装,当然,我感觉可以忽略这个,反正yum不会重复安装

cp完下面的shell之后记得复权 chmod 755

+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

#!/bin/sh


yum install -y *c++* *gcc* *vim* *openssh* *openssl* pcre* make* wget* git setuptool ntsysv iptables system-config-securitylevel-tui system-config-network-tui


mkdir /opt/src && cd /opt/src


wget http://gperftools.googlecode.com/files/gperftools-2.1.tar.gz |\

wget http://download.savannah.gnu.org/releases/libunwind/libunwind-1.1.tar.gz &&\

wget http://nginx.org/download/nginx-1.4.4.tar.gz  &&\

wget http://labs.frickle.com/files/ngx_cache_purge-2.1.tar.gz


git clone https://github.com/agentzh/redis2-nginx-module


tar zxvf gperftools-2.1.tar.gz &&  tar zxvf libunwind-1.1.tar.gz && tar zxvf ngx_cache_purge-2.1.tar.gz && tar zxvf nginx-1.4.4.tar.gz


cd /opt/src/libunwind-1.1 &&  ./configure && make && make install &&\

cd /opt/src/gperftools-2.1 && ./configure && make && make install &&\echo "/usr/local/lib" > /etc/ld.so.conf.d/usr_local_lib.conf && /sbin/ldconfig && \

cd /opt/src/nginx-1.4.4 && ./configure --prefix=/usr/local/nginx/ --user=nobody --group=nobody \

--with-http_ssl_module --with-file-aio --with-http_gzip_static_module \

--with-http_addition_module --with-google_perftools_module --with-http_stub_status_module \

--add-module=../ngx_cache_purge-2.1 --add-module=/opt/src/redis2-nginx-module && make &&  make install

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

记得关闭防火墙iptables -F,在浏览器输入本机IP

编译安装 nginx_nginx