下载nginx安装包 wget http://nginx.org/download/nginx-1.9.15.tar.gz && tar xvf nginx-1.9.15.tar.gz && cd nginx-1.9.15
./configure 这一步是发生报错:
./configure: error: the HTTP gzip module requires the zlib library.
You can either disable the module by using --without-http_gzip_module
option, or install the zlib library into the system, or build the zlib library
statically from the source with nginx by using --with-zlib=<path> option.
很明显缺少依赖包zlib
首先想到的是yum -y install zlib
不知道咋回事儿没装上去 (我用的是eprl的网络源)在这里不纠结为啥yum不能安装的问题
立马祭出一条命令:find / -name zlib
[[email protected] nginx-1.9.15]# find / -name zlib
/etc/yum.repos.d/nginx-1.9.15/auto/lib/zlib
nginx源码包自带zlib
接下来在编译的时候:./configure --prefix==/usr/local/nginx --with-zlib=/etc/yum.repos.d/nginx-1.9.15/auto/lib/zlib
报错信息中发现不再是缺少zlib包,缺少其他包也可以按照这种操作进行直到最后输出结果为
nginx path prefix: "/usr/local/product/nginx1.9.14"
nginx binary file: "/usr/local/product/nginx1.9.14/sbin/nginx"
nginx modules path: "/usr/local/product/nginx1.9.14/modules"
nginx configuration prefix: "/usr/local/product/nginx1.9.14/conf"
nginx configuration file: "/usr/local/product/nginx1.9.14/conf/nginx.conf"
nginx pid file: "/usr/local/product/nginx1.9.14/logs/nginx.pid"
nginx error log file: "/usr/local/product/nginx1.9.14/logs/error.log"
nginx http access log file: "/usr/local/product/nginx1.9.14/logs/access.log"
nginx http client request body temporary files: "client_body_temp"
nginx http proxy temporary files: "proxy_temp"
nginx http fastcgi temporary files: "fastcgi_temp"
nginx http uwsgi temporary files: "uwsgi_temp"
nginx http scgi temporary files: "scgi_temp"
输出以上信息表示nginx编译成功