Nginx之旅系列 - Nginx的configuration

题记:Nginx之旅系列是用来记录Nginx从使用到源码学习的点点滴滴,分享学习Nginx的快乐

Nginx 首页: http://nginx.org/

Nginx的configuration

今天对Nginx开始小试牛刀,其实对Nginx几年之前便久仰大名,由于之前精力一直局限在TCP/IP协议栈,也只是偶尔看看Nginx相关的资料。最近计划把协议栈传输层和传输之上层结合Nginx一起看,也算是从应用程序的角度来协议栈,学以致用。

对于Nginx的编译配置以及安装其实没什么好说的,但是今天在./configuration的时候发现了一个小问题网上有的帖子没有说明白,就是配置的时候会check相关的库函数。我们可以看到

目录nginx-1.5.2/auto/lib下相关的库包括:

geoip google-perftools libatomic libgd libxslt md5 openssl pcre perl sha1 zlib

其中的一处错误提示是:

./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.

看到网上很多帖子的解决办法是 apt-get install libssl-dev,但是估计很多人还是不明白为什么zlib和libssl-dev有什么关系。其实在apt-get install libssl-dev的时候会安装三个相关的文件: libssl-dev, libssl-doc, zlib1g-dev。上面的错误其实可以直接apt-get install zlib1g-dev,避免重复的安装相同的库文件。这个其实不是什么重要的问题,但是既然遇到了,就报着治学的态度还是知其然知其所以然吧。