找回密码
 立即注册

QQ登录

只需一步,快速开始

查看: 2286|回复: 0

yum安装的nginx,后续添加第三方模块

[复制链接]
发表于 2016-12-2 18:52:20 | 显示全部楼层 |阅读模式
第一步:查看nginx configure arguments。
命令:nginx -V
记录下configure arguments,后续编译的时候要用到。
第二步:去Nginx官网下载对应版本的nginx,下载需要添加的第三方模块。
然后./configure 加上前面记录下的configure arguments,再加上后续需要添加的模块

注意,nginx会遇到的错误:
可能出现错误
在配置信息./configure --prefix=/usr/local/nginx 的时,出现错误:
/configure: error: the HTTP rewrite module requires the PCRE library.
解决方法:安装pcre
yum -y install pcre pcre-devel
-y 是跳过所有需要手动确认的环节

缺少ssl错误,错误信息如下:
./configure: error: the HTTP cache module requires md5 functions
from OpenSSL library.   You can either disable the module by using
--without-http-cache option, or install the OpenSSL library into the system,
or build the OpenSSL library statically from the source with nginx by using
--with-http_ssl_module --with-openssl=<path> options.
解决方法:安装openssl
yum -y install openssl openssl-devel

缺少编译器,错误信息如下:
./configure: error: C compiler cc is not found
解决方法:安装gcc-c++
yum -y install gcc-c++ autoconf automake

autoconf是自动配置,automake是自动编译
缺少zlib包,错误信息如下:
./configure: error: the HTTP gzip module requires the zlib library.
You can either disable the module by using –without-http_gzip_module
option, or install the zlib library into the system, or build the zlib
library
statically from the source with nginx by using –with-zlib=<path> option.
解决方法:安装zlib
yum install -y zlib-devel

确实libxml2,错误信息如下:
./configure: error: the HTTP XSLT module requires the libxml2/libxslt
libraries. You can either do not enable the module or install the libraries.
解决方法:
yum -y install libxml2 libxml2-dev
yum -y install libxslt-devel

http_image_filter_module是nginx提供的集成图片处理模块,需要gd-devel的支持,错误信息如下:
./configure: error: the HTTP image filter module requires the GD library.
You can either do not enable the module or install the libraries.
解决方法:
yum -y install gd-devel

缺少ExtUtils,错误信息如下:
./configure: error: perl module ExtUtils::Embed is required
解决方法:
yum -y install perl-devel perl-ExtUtils-Embed

缺少GeoIP,错误信息如下:
./configure: error: the GeoIP module requires the GeoIP library.
You can either do not enable the module or install the library.
解决方法:
yum -y install GeoIP GeoIP-devel GeoIP-data

安装完成后启动
安装成功后 /usr/local/nginx 目录下如下
fastcgi.conf            koi-win             nginx.conf.default
fastcgi.conf.default    logs                scgi_params
fastcgi_params          mime.types          scgi_params.default
fastcgi_params.default  mime.types.default  uwsgi_params
html                    nginx               uwsgi_params.default
koi-utf                 nginx.conf          win-utf

启动
确保系统的 80 端口没被其他程序占用,运行/usr/local/nginx/nginx 命令来启动 Nginx,
netstat -ano|grep 80
如果查不到结果后执行,有结果则忽略此步骤(ubuntu下必须用sudo启动,不然只能在前台运行)
sudo /usr/local/nginx/nginx
打开浏览器访问此机器的 IP,如果浏览器出现 Welcome to nginx! 则表示 Nginx 已经安装并运行成功。



回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

快速回复 返回顶部 返回列表