[实战] 给现有的NGINX二进制RPM包加新模块
[实战] 给现有的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、下载
下载 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/
# 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 **
Nginx 多规则替换模块 ngx_http_substitutions_filter_module
四:效果图:

[实战] 给现有的NGINX二进制RPM包加新模块的更多相关文章
- 二十三.Subversion基本操作、使用Subversion协同工作、制作nginx的RPM包
1.Subversion基本操作 web1 1.1 安装Subversion服务器 ]# yum -y install subversion 1.1.1 创建版本库 ]# mkdir /var/svn ...
- 高级运维(七):Subversion基本操作、使用Subversion协同工作、制作nginx的RPM包
一.Subversion基本操作 目标: 本案例要求先快速搭建好一台Subversion服务器,并测试该版本控制软件: 1> 创建版本库 2> 导入初始化数据 3> 检出 ...
- 使用rpm-build制作nginx的rpm包
2014-11-27 11:05:49 一.RPM包的分类 RPM有五种基本的操作功能:安装.卸载.升级.查询和验证. linux软件包分为两大类: (1)二进制类包,包括rpm安装包(一般分为i ...
- Linux应用和系统库的2种安装方式---源码安装tarball和二进制rpm包
一.应用程序和系统库从哪里来? 两种机制,源码安装和二进制安装. 二.源码安装 tarball 1.核心思想是:利用开源代码,自己编译生成应用程序或者库,要求系统上必须已安装TMG(tar, make ...
- nginx的RPM包制作案例
使用nginx-1.12.2版本的源码软件,生成对应的RPM包软件,具体如下: - 软件名称为nginx - 软件版本为1.12.2 - RPM软件包可以查询描述信息 - RPM软件包可以安装及卸载 ...
- nginx使用热部署添加新模块
简介 当初次编译安装nginx时,http_ssl_module 模块默认是不编译进nginx的二进制文件当中,如果需要添加 ssl 证书.也就是使用 https协议.那么则需要添加 http_ssl ...
- 制作nginx的rpm包出现问题
在学习打包rpm,找到了个不错的参考站点 https://src.fedoraproject.org/cgit/rpms/ 过程: git clone -b el6 git://pkgs.fedor ...
- 解压查看二进制rpm包的方法
详细参考: man cpio 具体方法: rpm2cpio qt5-qtbase-5.6.0-13.fc21.x86_64.rpm | cpio -dium 执行后可在当前目录查看 安装目录 etc ...
- Centos 中如何快速定制二进制的内核RPM 包
随着Linux服务器越来越多了,底层系统内核想要保持版本统一就需要定制专门的二进制安装包来便捷的升级和管理. RedHat系那当然就是使用rpmbuild来做定制化管理了. 今天我们分俩个部分(roo ...
随机推荐
- 2017面向对象程序设计(Java)第十五周学习总结
上周,老师要求同学们自学应用程序部署,并布置了相关的实验任务.此次实验的目的是掌握Java应用程序的打包操作:了解应用程序存储配置信息的两种方法: 了解Applet小应用程序的开发及应用方法:掌握基于 ...
- Redis OBJECT命令
[Redis OBJECT命令] 1.OBJECT subcommand [arguments [arguments]] OBJECT 命令允许从内部察看给定 key 的 Redis 对象. 它通常用 ...
- How To Use Google Flags
[How To Use Google Flags] 1.Commandline flags are flags that users specify on the command line when ...
- final关键字的简单理解
final可以修饰类,方法,变量. 1.final修饰的类,不可以被继承. 2.final修饰方法,可以把方法锁定,以防任何继承类修改它的含义. 3.fianl修饰的变量,如果是基本数据类型的变量,则 ...
- 28. Implement strStr() (String)
Implement strStr(). Returns the index of the first occurrence of needle in haystack, or -1 if needle ...
- Visual studio 2017编译 boost
下载: https://www.boost.org/ 或者 https://dl.bintray.com/boostorg/release/1.66.0/source/ 下载完成以后解压到自己想要 ...
- Swift与OC的相互调用
Swift经过四年的发展已经趋于成熟,是时候学一下了,感谢公司swift大佬的不吝赐教.心有所感记录一下,如有不足欢迎指正批评. 新建swift项目 新建Swift.OC类文件 可在新建OC文件时,建 ...
- Docker使用link建立容器之间的连接
我们在使用Docker的时候,经常可能需要连接到其他的容器,比如:web服务需要连接数据库.按照往常的做法,需要先启动数据库的容器,映射出端口来,然后配置好客户端的容器,再去访问.其实针对这种场景,D ...
- MySQL数据库远程连接的配置方案
首先,目的是使用本机可视化工具SQLyog通过IP地址远程访问另一台机器上的MySQL数据库. 本人实践的MySQL版本是MySQL 5.7.23,数据库部署的主机系统是Windows.这些简单配置均 ...
- [Python]利用type()动态创建类
Python作为动态语言,可以动态地创建函数和类定义.比如说定义一个Hello类,就写一个hello.py模块: #! /usr/bin/env python #coding=utf-8 class ...