[实战] 给现有的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. 2015年传智播客JavaEE 第168期就业班视频教程11-导入配置文件

    资源文件放在Source Folder目录下面,这个目录同样会编译到classes目录下 web.xml的 <listener> <listener-class>org.spr ...

  2. ios Https问题

    HTTPS认证过程:   ① 浏览器发送一个连接请求给安全服务器.   ② 服务器将自己的证书,以及同证书相关的信息发送给客户浏览器.   ③ 客户浏览器检查服务器送过来的证书是否是由自己信赖的 CA ...

  3. js获得URL中的参数

    js获得URL中的参数 function GetQueryString(name) { var reg = new RegExp("(^|&)" + name + &quo ...

  4. SGU 194 Reactor Cooling (有容量和下界的可行流)

    题意:给定上一个有容量和下界的网络,让你求出一组可行解. 析:先建立一个超级源点 s 和汇点 t ,然后在输入时记录到每个结点的下界的和,建边的时候就建立c - b的最后再建立 s 和 t , 在建立 ...

  5. python之使用API(WEB应用编程接口)

    1.处理API响应 import requests #执行API调用并存储响应 url = "https://api.github.com/search/repositories?q=lan ...

  6. Freedom DownTime

    Storyline Computer hackers are being portrayed as the newest brand of terrorists. This is a story of ...

  7. LARGE SCALE GAN TRAINING FOR HIGH FIDELITY NATURAL IMAGE SYNTHESIS

    最强GAN图像生成器,真假难辨 论文地址: https://openreview.net/pdf?id=B1xsqj09Fm 更多样本地址: https://drive.google.com/driv ...

  8. 移动端html5页面导航栏悬浮遮挡内容第一行解决办法

    参考:https://zhidao.baidu.com/question/1608232105428062147.html 1.设置导航栏div属性position:fixed; .nav-fixed ...

  9. J-Link eclipse Plug-ins install

    Quicklinks If you know what this is all about and you just need the update site details: name: GNU A ...

  10. Solr相似度算法一:DefaultSimilarity(基于TF-IDF的默认相似度算法)

    默认的similarity是基于TF/IDF 模块. 该 similarity有以下配置选项: discount_overlaps –确定是否重叠的标识(标记位置增量为0)都将被忽略在正常计算的时候. ...