nginx安装第三方模块

简介:

nginx文件非常小,但是性能非常的高效,这方面完胜apache,nginx文件小的一个原因之一是nginx自带的功能相对较少,好在nginx允许第三方模块,第三方模块使得nginx越发的强大. 在安装模块方面,nginx显得没有apache安装模块方便,当然也没有php安装扩展方便.在原生的nginx,不可以动态加载模块,所以当你安装第三方模块的时候需要覆盖nginx文件。

接下来看看如何安装nginx第三模块吧:


nginx第三方模块安装方法:

./configure --prefix=/你的安装目录  --add-module=/第三方模块目录


下载模块:

# cd /usr/local/src

# wget https://github.com/cfsego/file-md5/archive/master.zip -O file-md5-master.zip

# unzip file-md5-master.zip


安装分为二种情况:

1、从未安装过nginx,编译时指定编译参数和添加第三方模块目录


[root@localhost ~]# cd /usr/local/src/nginx-1.6.2

[root@localhost nginx-1.6.2]# ./configure --prefix=/usr/local/nginx --with-pcre --with-http_stub_status_module --with-http_ssl_module --with-http_gzip_static_module --add-module=../file-md5-master

[root@localhost nginx-1.6.2]#make

[root@localhost nginx-1.6.2]#make install

[root@localhost nginx-1.6.2]# /usr/local/nginx/sbin/nginx


2、已经安装过nginx,需要重新编译,以前编译的参数也要加上,再添加第三方模块即可

[root@localhost ~]# cd /usr/local/src/nginx-1.6.2

[root@localhost nginx-1.6.2]# ./configure --prefix=/usr/local/nginx --with-pcre --with-http_stub_status_module --with-http_ssl_module --with-http_gzip_static_module --add-module=../file-md5-master

[root@localhost nginx-1.6.2]#make

[root@localhost nginx-1.6.2]#cp objs/nginx /usr/local/nginx/sbin/

[root@localhost nginx-1.6.2]# /usr/local/nginx/sbin/nginx


总结:安装nginx安装第三方模块实际上是使用--add-module重新安装一次nginx,不要make install而是直接把编译目录下objs/nginx文件直接覆盖老的nginx文件.如果你需要安装多个nginx第三方模块,你只需要多指定几个相应的--add-module即可.


备注:重新编译的时候,记得一定要把以前编译过的模块一同加到configure参数里面.





本文转自 模范生 51CTO博客,原文链接:http://blog.51cto.com/mofansheng/1900326,如需转载请自行联系原作者

目录
相关文章
|
1月前
|
应用服务中间件 nginx
Nginx安装nginx-rtmp-module模块
【2月更文挑战第4天】 nginx中的模块虽然就是类似插件的概念,但是它无法像VsCode那样轻松的安装扩展。 nginx要安装其它模块必须同时拿到nginx源代码和模块源代码,然后手动编译,将模块打到nginx中,最终生成一个名为nginx的可执行文件。
71 6
|
2月前
|
负载均衡 Ubuntu 应用服务中间件
|
22天前
|
网络协议 应用服务中间件 网络安全
linxu安装nginx
linxu安装nginx
48 0
|
30天前
|
NoSQL 关系型数据库 MySQL
Docker安装详细步骤及相关环境安装配置(mysql、jdk、redis、自己的私有仓库Gitlab 、C和C++环境以及Nginx服务代理)
Docker安装详细步骤及相关环境安装配置(mysql、jdk、redis、自己的私有仓库Gitlab 、C和C++环境以及Nginx服务代理)
187 0
|
1月前
|
负载均衡 应用服务中间件 nginx
|
1月前
|
应用服务中间件 nginx Windows
windows下快速安装nginx 并配置开机自启动
windows下快速安装nginx 并配置开机自启动
windows下快速安装nginx 并配置开机自启动
|
1月前
|
Kubernetes 负载均衡 应用服务中间件
Ingress Nginx 安装【亲测可用】
Ingress Nginx 安装【亲测可用】
103 2
|
1月前
|
安全 应用服务中间件 nginx
|
1月前
|
负载均衡 应用服务中间件 Linux
|
1月前
|
前端开发 应用服务中间件 nginx
Docker安装nginx和基本配置
Docker安装nginx和基本配置
121 0