您的位置:首页 > 运维架构 > Nginx

nginx安装编译,动态添加模块及其各模块的作用

2017-03-28 09:17 726 查看
nginx第三方模块下载地址:

https://www.nginx.com/resources/wiki/modules/

nginx地址下载:

http://nginx.org/en/download.html

nginx版本号:1.8.1

./configure  \                                                                                                                             

    --user=nginx \

    --group=nginx \

    --prefix=/usr/local/myinstall/nginx \

    --error-log-path=/var/log/nginx/error.log \

    --http-log-path=/var/log/nginx/access.log \

    --sbin-path=/usr/sbin/nginx \

    --conf-path=/etc/nginx/nginx.conf \

    --pid-path=/var/run/nginx.pid \

    --lock-path=/var/lock/subsys/nginx \

    --with-http_random_index_module \  #从目录中随机选出一个文件作为主页

    --with-http_ssl_module \ #提供https支持

    --with-http_realip_module \ #允许修改请求头客户端的ip地址(X-Real-IP和X-Forwarded-For)

    --with-http_addition_module \ #在客户端请求的文件的开头或者结尾添加额外的内容

    --with-http_sub_module \ #在客户端请求的文件,把某些字符串替换

    --with-http_dav_module \ #扩展了http协议

    --with-http_flv_module \  #搭建flv视频服务器使用的

    --with-http_gzip_static_module \

    --with-http_geoip_module \

    --add-module=/usr/local/src/nginx/nginx-3rd/nginx-module-url \

    --add-module=/usr/local/src/nginx/nginx-3rd/ngx_http_consistent_hash \

    --add-module=/usr/local/src/nginx/nginx-3rd/nginx-upstream-fair \

    --add-module=/usr/local/src/nginx/nginx-3rd/ngx_cache_purge

其中可能报错误,pcre library找不到,下载pcre-devel就可以了

还可能报错误,geoip library找不到,下载geoip-devel就可以了,这个rpm包有可能yum下载找不到,

则需要配置epel源 ,如下

rpm -ivh http://dl.fedoraproject.org/pub/
... ease-5-4.noarch.rpm

rpm
--import /etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-5

这样源就配置好了
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: