linux 下nginx模块的安装

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了linux 下nginx模块的安装相关的知识,希望对你有一定的参考价值。

安装

第一步 下载并解压nginx压缩包

从Nginx官网下载Nginx,或者在Linux上执行wget http://nginx.org/download/nginx-1.10.1.tar.gz命令直接下载
解压nginx-1.10.1.tar.gz文件:

tar zxvf nginx-1.10.1.tar.gz
1
1
第二步 配置

cd nginx-1.10.1
./configure --prefix=/usr/local/nginx
1
2
1
2
注意:
① 如果之前没有安装C compiler(C 编译器),这一步将报如下错误信息:

xueliang@dev:~/download/nginx-1.10.1$ ./configure –prefix=/usr/local/nginx
checking for OS
+ Linux 4.2.0-27-generic x86_64
checking for C compiler … not found

./configure: error: C compiler cc is not found

xueliang@dev:~/download/nginx-1.10.1$
可以参考这篇文章安装C compiler,然后继续下面的操作

② 如果之前没有安装PCRE,这一步将报如下错误信息:

checking for PCRE library … not found
checking for PCRE library in /usr/local/ … not found
checking for PCRE library in /usr/include/pcre/ … not found
checking for PCRE library in /usr/pkg/ … not found
checking for PCRE library in /opt/local/ … not found

./configure: error: the HTTP rewrite module requires the PCRE library.
You can either disable the module by using –without-http_rewrite_module
option, or install the PCRE library into the system, or build the PCRE library
statically from the source with nginx by using –with-pcre= option.

xueliang@dev:~/download/nginx-1.10.1$

③ 如果之前没有安装zlib,这一步将报如下错误信息:

checking for md5 in system md library … not found
checking for md5 in system md5 library … not found
checking for md5 in system OpenSSL crypto library … not found
checking for sha1 in system md library … not found
checking for sha1 in system OpenSSL crypto library … not found
checking for zlib library … not found

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

xueliang@dev:~/download/nginx-1.10.1$

也可以跳过此步,执行默认安装,--prefix的默认值为/usr/local/nginx,Nginx官网对此有说明:Building nginx from Sources
参考技术A nginx -V如果你是源码包编译安装

以上是关于linux 下nginx模块的安装的主要内容,如果未能解决你的问题,请参考以下文章

linux 下安装 nginx 加 rtmp 模块

Linux下安装php环境并且配置Nginx支持php-fpm模块[www]

如何安装nginx第三方模块

如何安装nginx第三方模块

Linux下安装Nginx+php并配置php-fpm模块

linux下安装nginx