Linux:在已安装nginx情况下安装nginx模块
在已安装nginx情况下安装nginx模块
nginx第三方模块安装方法:
./configure --prefix=/你的安装目录 --add-module=/第三方模块目录
1、.查看nginx编译安装时的命令,安装了哪些模块
#/usr/local/webserver/nginx/sbin/nginx -V
2、切换到root用户
#su root
3、在已安装nginx情况下安装nginx模块(username为系统用户名)
# sudo ./configure --prefix=/usr/local/nginx --with-pcre=/home/username/下载/nginx/pcre-8.32 --with-zlib=/home/username/下载/nginx/zlib-1.2.8 --with-openssl=/home/username/下载/nginx/openssl-1.0.2a --add-module=/home/username/下载/nginx/nginx_mod_h264_streaming-2.2.7
# make
# cp objs/nginx /usr/local/nginx/sbin/nginx
#. /usr/local/nginx-1.4.1/sbin/nginx
相比在未安装nginx的情况下安装nginx第三方模块,多了一步覆盖nginx文件.
如果在./configure前不加 sudo,会出现以下错误提示:
./configure: 45: auto/init: cannot create Makefile: Permission denied ./configure: 16: ./configure: cannot create objs/ngx_auto_headers.h: Permission denied ./configure: 17: ./configure: cannot create objs/autoconf.err: Permission denied ./configure: 19: ./configure: cannot create objs/ngx_auto_config.h: Permission denied checking for OS + Linux 3.16.0-30-generic i686 checking for C compiler ..../configure: 8: auto/feature: cannot create objs/autoconf.err: Permission denied ./configure: 28: auto/feature: cannot create objs/autotest.c: Permission denied ./configure: 1: eval: cannot create objs/autoconf.err: Permission denied not found ./configure: 116: auto/feature: cannot create objs/autoconf.err: Permission denied ./configure: 117: auto/feature: cannot create objs/autoconf.err: Permission denied ./configure: 118: auto/feature: cannot create objs/autoconf.err: Permission denied ./configure: 119: auto/feature: cannot create objs/autoconf.err: Permission denied ./configure: 120: auto/feature: cannot create objs/autoconf.err: Permission denied ./configure: error: C compiler cc is not found
---------------------------------------
解决方案:
sudo ./configure --prefix=/usr/local/nginx --with-pcre=/home/user/下载/nginx/pcre-8.32 --with-zlib=/home/user/下载/nginx/zlib-1.2.8 --with-openssl=/home/user/下载/nginx/openssl-1.0.2a --add-module=/home/user/下载/nginx/nginx_mod_h264_streaming-2.2.7
4、总结
在已安装nginx情况下安装第三方模块实际上是使用–add-module重新安装一次nginx,不要make install而是直接把编译目录下objs/nginx文件直接覆盖旧的nginx文件.如果你需要安装多个nginx第三方模块,你只需要多指定几个相应的–add-module即可.
备注:重新编译的时候,记得一定要把以前编译过的模块一同加到configure参数里面.
nginx提供了非常多的nginx第三方模块提供安装,地址http://wiki.nginx.org/3rdPartyModules
郑重声明:本站内容如果来自互联网及其他传播媒体,其版权均属原媒体及文章作者所有。转载目的在于传递更多信息及用于网络分享,并不代表本站赞同其观点和对其真实性负责,也不构成任何其他建议。