博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
如何安装nginx第三方模块
阅读量:4044 次
发布时间:2019-05-24

本文共 1347 字,大约阅读时间需要 4 分钟。

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

nginx第三方模块安装方法:

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

以安装pagespeed模块实例

在未安装nginx的情况下安装nginx第三方模块

1
2
3
4
5
6
7
8
# ./configure --prefix=/usr/local/nginx-1.4.1 \
--
with
-
http_stub_status
_module
\
--
with
-
http_ssl_module
--
with
-
http_realip
_module
\
--
with
-
http_image_filter
_module
\
--
add
-
module
=
.
.
/
ngx_pagespeed
-
master
--
add
-
module
=
/第三方模块目录
# make
# make install
# /usr/local/nginx-1.4.1/sbin/nginx

在已安装nginx情况下安装nginx模块

1
2
3
4
5
6
7
8
9
# ./configure --prefix=/usr/local/nginx-1.4.1 \
--
with
-
http_stub_status
_module
\
--
with
-
http_ssl_module
--
with
-
http_realip
_module
\
--
with
-
http_image_filter
_module
\
--
add
-
module
=
.
.
/
ngx_pagespeed
-
master
# make
# /usr/local/nginx-1.4.1/sbin/nginx -s stop
# cp objs/nginx /usr/local/nginx/sbin/nginx
# /usr/local/nginx-1.4.1/sbin/nginx

相比之下仅仅多了一步覆盖nginx文件.

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

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

nginx提供了非常多的nginx第三方模块提供安装,地址http://wiki.nginx.org/3rdPartyModules

转载地址:http://cwhdi.baihongyu.com/

你可能感兴趣的文章
通过C++反射实现C++与任意脚本(lua、js等)的交互(二)
查看>>
利用清华镜像站解决pip超时问题
查看>>
[leetcode BY python]1两数之和
查看>>
微信小程序开发全线记录
查看>>
PTA:一元多项式的加乘运算
查看>>
CCF 分蛋糕
查看>>
解决python2.7中UnicodeEncodeError
查看>>
小谈python 输出
查看>>
Django objects.all()、objects.get()与objects.filter()之间的区别介绍
查看>>
python:如何将excel文件转化成CSV格式
查看>>
机器学习实战之决策树(一)
查看>>
机器学习实战之决策树二
查看>>
[LeetCode By Python]7 Reverse Integer
查看>>
[leetCode By Python] 14. Longest Common Prefix
查看>>
[LeetCode By Python]121. Best Time to Buy and Sell Stock
查看>>
[LeetCode By Python]122. Best Time to Buy and Sell Stock II
查看>>
[LeetCode By Python]125. Valid Palindrome
查看>>
[LeetCode By Python]136. Single Number
查看>>
SVN客户端命令详解
查看>>
Android/Linux 内存监视
查看>>