Linux下Nginx的安装步骤

一、下载pcre

官网下载:http://www.pcre.org/

# wget http://sourceforge.net/projects/pcre/files/pcre/8.35/pcre-8.35.tar.gz/download

# cd /pcre-8.35


二、下载purge模块(用于删除Nginx缓存)

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


三、安装zlib

# wget http://prdownloads.sourceforge.net/libpng/zlib-1.2.8.tar.gz?download

# tar zxvf zlib-1.2.8.tar.gz

# cd zlib-1.2.8

# ./configure --prefix=/usr/local/zlib

# make && make install


四、安装openssl

# wget http://www.openssl.org/source/openssl-1.0.1h.tar.gz

# cd openssl-1.0.1h.tar.gz 

# tar zxfv openssl-1.0.1h.tar.gz 

# cd openssl-1.0.1h

# ./config 
# ./config --prefix=/usr/local/openssl
# make && make install

五、安装gcc-c++
# yum install -y gcc-c++

六、下载最新的nginx稳定版进行安装
# wget http://nginx.org/download/nginx-1.7.2.tar.gz
# tar zxvf nginx-1.7.2.tar.gz
# ./configure --with-pcre=/data/software/pcre-8.35 --add-module=../ngx_cache_purge-2.1 --prefix=/usr/local/nginx --with-http_stub_status_module --with-http_ssl_module --with-zlib=/usr/local/zlib --with-openssl=/data/software/openssl-1.0.1h

安装:make && make install


注:如果出现:error: 'ngx_http_file_cache_node_t' has no member named 'length'异常,可能是ngx_cache_purge-2.1.tar.gz版本太旧导致

发布了28 篇原创文章 · 获赞 19 · 访问量 16万+

猜你喜欢

转载自blog.csdn.net/fengyily/article/details/35569671