阿里云-云小站(无限量代金券发放中)
【腾讯云】云服务器、云数据库、COS、CDN、短信等热卖云产品特惠抢购

Nginx安装第三方模块

146次阅读
没有评论

共计 2088 个字符,预计需要花费 6 分钟才能阅读完成。

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 参数里面.

下面关于 Nginx 的文章您也可能喜欢,不妨参考下:

CentOS 7.2 下编译安装 PHP7.0.10+MySQL5.7.14+Nginx1.10.1  http://www.linuxidc.com/Linux/2016-09/134804.htm

搭建基于 Linux6.3+Nginx1.2+PHP5+MySQL5.5 的 Web 服务器全过程 http://www.linuxidc.com/Linux/2013-09/89692.htm

Linux 下编译安装 Nginx 1.8.1 及配置 http://www.linuxidc.com/Linux/2017-02/140495.htm

CentOS 6.4 安装配置 Nginx+Pcre+php-fpm http://www.linuxidc.com/Linux/2013-08/88984.htm

Nginx 日志过滤 使用 ngx_log_if 不记录特定日志 http://www.linuxidc.com/Linux/2014-07/104686.htm

Nginx 的 500,502,504 错误解决方法 http://www.linuxidc.com/Linux/2015-03/115507.htm

CentOS 7 编译安装 Nginx1.10.2 脚本启动失败解决思路 http://www.linuxidc.com/Linux/2017-01/139794.htm

Nginx 的详细介绍:请点这里
Nginx 的下载地址:请点这里

本文永久更新链接地址:http://www.linuxidc.com/Linux/2017-02/140993.htm

正文完
星哥说事-微信公众号
post-qrcode
 0
星锅
版权声明:本站原创文章,由 星锅 于2022-01-21发表,共计2088字。
转载说明:除特殊说明外本站文章皆由CC-4.0协议发布,转载请注明出处。
【腾讯云】推广者专属福利,新客户无门槛领取总价值高达2860元代金券,每种代金券限量500张,先到先得。
阿里云-最新活动爆款每日限量供应
评论(没有评论)
验证码
【腾讯云】云服务器、云数据库、COS、CDN、短信等云产品特惠热卖中