[实战] 给现有的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. Common Lisp

    [Common Lisp] 1.操作符是什么? 2.quote. 3.单引号是quote的缩写. 4.car与cdr方法. 5.古怪的if语句. 6.and语句. 7.判断是真假. null 与 no ...

  2. Docker构建redis cluster集群

    准备工作 安装gcc ruby 解压编译redis Redis 是 c 语言开发的.安装 redis 需要 c 语言的编译环境.如果没有 gcc 需要在线安装. yum install gcc-c++ ...

  3. android 读取json数据(遍历JSONObject和JSONArray)(转)

    public String getJson(){ String jsonString = "{\"FLAG\":\"flag\",\"MES ...

  4. 什么是http头信息

    HTTP(HyperTextTransferProtocol)是超文本传输协议的缩写,它用于传送WWW方式的数据,Http协议定义了很多与服务器交互的方法,最基本的有4种,分别是GET.POST.PU ...

  5. SpringBoot配置Shiro时@RequiresRoles不起作用

    在SpringBoot中配置Shiro,结果@RequiresRoles.@RequiresPermissions等注解都无效 解决方法: 在ShiroConfiguration中注入开启支持aop. ...

  6. 126. Word Ladder II( Queue; BFS)

    Given two words (beginWord and endWord), and a dictionary's word list, find all shortest transformat ...

  7. react-navigation的多次点击重复跳转同一页面、不在堆栈路由页面使用navigation方法的解决思路

    一.react-navigation的初使用 createStackNavigator  ==> createSwitchNavigator  ==>  createAppContaine ...

  8. 解题报告-908. Smallest Range I

    题目 : Given an array A of integers, for each integer A[i] we may choose any x with -K <= x <= K ...

  9. Openssl dgst命令

    一.简介 消息摘要可以对任意长度的消息产生固定长度(16或20个字节)的信息摘要,理论基于单向HASH函数,根据消息摘要无法恢复出原文,所以是安全的:消息原文和消息摘要是一一对应的,所以又被称作指纹. ...

  10. 使用vim鼠标右键无法粘贴问题解决

    问题: Debian中通过终端使用vim,无法通过鼠标粘贴.这是由于一项默认的鼠标配置导致. 解决方法: vi /usr/share/vim/vim80/defaults.vim 查找set mous ...