[实战] 给现有的NGINX二进制RPM包加新模块

一、前言

在做 wiki 的镜像,这样以后文章就可以使用外链了(链接直接跳转墙内小站)。

遇到的问题就是:我的 NGINX 包安装的时候图方便采用 yum 进行的安装。为实现 wiki 镜像我需要给 Web 服务器加入模块 ``ngx_http_substitutions_filter_module ,但是具体怎么走如何实现。

二、正文

# 环境

I、操作系统

CentOS 6.9 64bit

# NGINX

1、安装
# yum -y install nginx

注意:我的操作系统该工具包是由 epel 仓库(由 fedora 为 centos 提供的高质量软件包项目)提供,如果您不可以安装。请完成以下操作。

# yum install epel-release
# yum clean all
# yum makecache
# yum install nmap -y
2、版本
≥ nginx -v
nginx version: nginx/1.10.2

这很重要,后面要找同版本的源代码包

3、参数
≥ nginx -V
nginx version: nginx/1.10.2
built by gcc 4.4.7 20120313 (Red Hat 4.4.7-17) (GCC)
built with OpenSSL 1.0.1e-fips 11 Feb 2013
TLS SNI support enabled
configure arguments: --prefix=/usr/share/nginx --sbin-path=/usr/sbin/nginx --modules-path=/usr/lib64/nginx/modules --conf-path=/etc/nginx/nginx.conf --error-log-path=/var/log/nginx/error.log --http-log-path=/var/log/nginx/access.log --http-client-body-temp-path=/var/lib/nginx/tmp/client_body --http-proxy-temp-path=/var/lib/nginx/tmp/proxy --http-fastcgi-temp-path=/var/lib/nginx/tmp/fastcgi --http-uwsgi-temp-path=/var/lib/nginx/tmp/uwsgi --http-scgi-temp-path=/var/lib/nginx/tmp/scgi --pid-path=/var/run/nginx.pid --lock-path=/var/lock/subsys/nginx --user=nginx --group=nginx --with-file-aio --with-ipv6 --with-http_ssl_module --with-http_v2_module --with-http_realip_module --with-http_addition_module --with-http_xslt_module=dynamic --with-http_image_filter_module=dynamic --with-http_geoip_module=dynamic --with-http_sub_module --with-http_dav_module --with-http_flv_module --with-http_mp4_module --with-http_gunzip_module --with-http_gzip_static_module --with-http_random_index_module --with-http_secure_link_module --with-http_degradation_module --with-http_slice_module --with-http_stub_status_module --with-http_perl_module=dynamic --with-mail=dynamic --with-mail_ssl_module --with-pcre --with-pcre-jit --with-stream=dynamic --with-stream_ssl_module --with-debug --with-cc-opt='-O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic' --with-ld-opt=' -Wl,-E'

参照得到的参数,完成源代码编译

III、找到匹配的源代码

打开浏览器,输出地址https://nginx.org/download/

查找nginx -v显示出的版本号,进行源代码下载。

注意:一定要和nginx -v得到的完全一致。0.1 个小版本都不可以。

作者之前就是作死提高了一个小版本,然后编译完成进入了nginx的数据库。运行不了、删除不掉。然后备份,重装,折腾了一遍还原了。

三、实验

I、下载

  1. 下载 ngx_http_substitutions_filter_module 需要使用 git 下载安装包,https://github.com/yaoweibin/ngx_http_substitutions_filter_module

    2.下载最新的源码包。安装需要依赖pcre(PERL 5 regular expression pattern matching): http://sourceforge.net/projects/pcre/files/pcre/

    3.zlib: http://sourceforge.net/projects/libpng/files/zlib/。

# cd /tmp
# wget https://downloads.sourceforge.net/project/pcre/pcre/8.41/pcre-8.41.zip
# wget https://sourceforge.net/projects/libpng/files/zlib/1.2.11/zlib1211.zip
# git clone https://github.com/yaoweibin/ngx_http_substitutions_filter_module
# wget -P /tmp https://nginx.org/download/nginx-1.10.2.tar.gz
# tar -xf /tmp/nginx-1.10.2.tar.gz

II、配置

./configure --prefix=/usr/share/nginx --sbin-path=/usr/sbin/nginx --modules-path=/usr/lib64/nginx/modules --conf-path=/etc/nginx/nginx.conf --error-log-path=/var/log/nginx/error.log --http-log-path=/var/log/nginx/access.log --with-pcre=/tmp/pcre-8.41 --with-zlib=/tmp/zlib-1.2.11 --add-module=/tmp/ngx_http_substitutions_filter_module --http-client-body-temp-path=/var/lib/nginx/tmp/client_body --http-proxy-temp-path=/var/lib/nginx/tmp/proxy --http-fastcgi-temp-path=/var/lib/nginx/tmp/fastcgi --http-uwsgi-temp-path=/var/lib/nginx/tmp/uwsgi --http-scgi-temp-path=/var/lib/nginx/tmp/scgi --pid-path=/var/run/nginx.pid --lock-path=/var/lock/subsys/nginx --user=nginx --group=nginx --with-file-aio --with-ipv6 --with-http_ssl_module --with-http_v2_module --with-http_realip_module --with-http_addition_module --with-http_xslt_module=dynamic --with-http_image_filter_module=dynamic --with-http_geoip_module=dynamic --with-http_sub_module --with-http_dav_module --with-http_flv_module --with-http_mp4_module --with-http_gunzip_module --with-http_gzip_static_module --with-http_random_index_module --with-http_secure_link_module --with-http_degradation_module --with-http_slice_module --with-http_stub_status_module --with-http_perl_module=dynamic --with-mail=dynamic --with-mail_ssl_module --with-pcre --with-pcre-jit --with-stream=dynamic --with-stream_ssl_module --with-debug --with-cc-opt='-O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic' --with-ld-opt='-Wl,-E'

重点是:**--with-pcre=/tmp/pcre-8.41 --with-zlib=/tmp/zlib-1.2.11 --add-module=/tmp/ngx_http_substitutions_filter_module **

Linux Nginx安装以及可能出现错误

Nginx 多规则替换模块 ngx_http_substitutions_filter_module

四:效果图:

[实战] 给现有的NGINX二进制RPM包加新模块的更多相关文章

  1. 二十三.Subversion基本操作、使用Subversion协同工作、制作nginx的RPM包

    1.Subversion基本操作 web1 1.1 安装Subversion服务器 ]# yum -y install subversion 1.1.1 创建版本库 ]# mkdir /var/svn ...

  2. 高级运维(七):Subversion基本操作、使用Subversion协同工作、制作nginx的RPM包

    一.Subversion基本操作 目标: 本案例要求先快速搭建好一台Subversion服务器,并测试该版本控制软件: 1> 创建版本库    2> 导入初始化数据    3> 检出 ...

  3. 使用rpm-build制作nginx的rpm包

    2014-11-27 11:05:49   一.RPM包的分类 RPM有五种基本的操作功能:安装.卸载.升级.查询和验证. linux软件包分为两大类: (1)二进制类包,包括rpm安装包(一般分为i ...

  4. Linux应用和系统库的2种安装方式---源码安装tarball和二进制rpm包

    一.应用程序和系统库从哪里来? 两种机制,源码安装和二进制安装. 二.源码安装 tarball 1.核心思想是:利用开源代码,自己编译生成应用程序或者库,要求系统上必须已安装TMG(tar, make ...

  5. nginx的RPM包制作案例

    使用nginx-1.12.2版本的源码软件,生成对应的RPM包软件,具体如下: - 软件名称为nginx - 软件版本为1.12.2 - RPM软件包可以查询描述信息 - RPM软件包可以安装及卸载 ...

  6. nginx使用热部署添加新模块

    简介 当初次编译安装nginx时,http_ssl_module 模块默认是不编译进nginx的二进制文件当中,如果需要添加 ssl 证书.也就是使用 https协议.那么则需要添加 http_ssl ...

  7. 制作nginx的rpm包出现问题

    在学习打包rpm,找到了个不错的参考站点  https://src.fedoraproject.org/cgit/rpms/ 过程: git clone -b el6 git://pkgs.fedor ...

  8. 解压查看二进制rpm包的方法

    详细参考: man cpio 具体方法: rpm2cpio qt5-qtbase-5.6.0-13.fc21.x86_64.rpm | cpio -dium 执行后可在当前目录查看 安装目录  etc ...

  9. Centos 中如何快速定制二进制的内核RPM 包

    随着Linux服务器越来越多了,底层系统内核想要保持版本统一就需要定制专门的二进制安装包来便捷的升级和管理. RedHat系那当然就是使用rpmbuild来做定制化管理了. 今天我们分俩个部分(roo ...

随机推荐

  1. What I'm Researching

    [What I'm Researching] 1.C++11 2.NLP 3.android dev 4.warm up 5.PageRank

  2. canvas动画--demo

    canvas动画:bubble

  3. 九度oj-1533 最长上升子序列 (LIS)

    http://ac.jobdu.com/problem.php?pid=1533 题目描述: 给定一个整型数组, 求这个数组的最长严格递增子序列的长度. 譬如序列1 2 2 4 3 的最长严格递增子序 ...

  4. springboot 配置jsp支持

      springboot默认并不支持jsp模板,所以需要配置. 下面是一个可以运行的例子: 首先配置属性文件: spring.http.encoding.force=true spring.http. ...

  5. Forms in Angular 2

    Input handling is an important part of application development. The ng-model directive provided in A ...

  6. 利用NotePad++ 格式化代码(格式标准化) worldsing

    在阅读别人的代码时往往会遇到格式很乱,阅读起来很费劲,如果手动改很容易出错,而且很费时间,这时可以借助一些专业的编辑器来格式化代码,NotePad++是一个轻量级的代码编辑器,占用内存少,运行速度快, ...

  7. Linux的进程与服务(一)

    启动的配置文件/etc/inittab,修改完配置文件以后 init q立即生效 # Default runlevel. The runlevels used by RHS are: # - halt ...

  8. 日志文件(关于#IRSA_MDPS_RDM软件 密码登录事项 7月26号)

    1.登录:sqlplus 用户名:scott 口令:123 qweas.. //2018-7-16号更改密码 2.查看该用户(已登录)下有几个表:select table_name from user ...

  9. SQLITE3的锁以及事务

    以下内容摘自<SQLITE权威指南>,下载地址http://download.csdn.net/detail/cxjchen/5643391   SQLITE的锁 在SQLite中,锁和事 ...

  10. polymer-quick tour of polymer

    注册一个元素 <link rel="import" href="bower_components/polymer/polymer.html">//没 ...