码迷,mamicode.com
首页 > 系统相关 > 详细

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

时间:2015-05-18 08:59:34      阅读:176      评论:0      收藏:0      [点我收藏+]

标签: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


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

标签:nginx   第三方模块   

原文地址:http://blog.csdn.net/sange77/article/details/45812301

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!