1.下载tar包,或者去网站手动下载,wget http://nginx.org/download/nginx-1.11.6.tar.gz
2.解压到/usr/local/, tar xzvf nginx-1.11.6.tar.gz -C /usr/local/
3.cd /usr/local/nginx-1.11.6切换到nginx安装目录
./configure进行初始化配置,出现报错./configure: error: C compiler cc is not found
解决:yum -y install gcc gcc-c++ autoconf automake make
继续报错:./configure: error: the HTTP rewrite module requires the PCRE library.说明该机器没有安装PCRE,而nginx需要依赖PCRE
解决:yum -y install pcre-devel
继续报错:./configure: error: the HTTP gzip module requires the zlib library.说还需要zlib library
解决:yum install -y zlib-devel,然后./configure初始化配置终于好了(但是提示没用openssl,yum -y install openssl* ,用来支持https)
Configuration summary
+ using system PCRE library
+ OpenSSL library is not used
+ using system zlib library
nginx path prefix: "/usr/local/nginx"