编译安装最新的nginx,带第三方模块 headers-more-nginx-module

请先按照教程安装最新的openssl

https://my.oschina.net/liuguangqiang/blog/2243639

1:下载headers-more-nginx-module模块

https://github.com/openresty/headers-more-nginx-module/releases

解压到headers-more-nginx-module目录备用

2:下载最新的nginx源码

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

解压到对应目录

3:cd到nginx源码目录

vim auto/lib/openssl/conf

#找到以下内容把.openssl去掉  

CORE_INCS="$CORE_INCS $OPENSSL/.openssl/include"  

CORE_DEPS="$CORE_DEPS $OPENSSL/.openssl/include/openssl/ssl.h"  

CORE_LIBS="$CORE_LIBS $OPENSSL/.openssl/lib/libssl.a"  

CORE_LIBS="$CORE_LIBS $OPENSSL/.openssl/lib/libcrypto.a"  

CORE_LIBS="$CORE_LIBS $NGX_LIBDL"  

保存

4:安装各种依赖

yum -y install gcc

yum -y install openssl openssl-devel
yum -y install pcre pcre-devel
yum -y install gcc-c++ autoconf automake
yum install -y zlib-devel
yum -y install libxml2 libxml2-dev
yum -y install libxslt-devel
yum -y install gd-devel
yum -y install perl-devel perl-ExtUtils-Embed
yum -y install GeoIP GeoIP-devel GeoIP-data

5:编译安装

./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 --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-openssl=/usr/local/openssl  --add-module=/root/nginx-1.15.5/headers-more-nginx-module-0.33

注意:标红的为第三方模块,不用可以不安装。配置根据rpm包编译配置,会覆盖掉使用yum安装的nginx

紫色字体为指定最新的openssl路径

6:编译

make

make install

完成

转载于:https://my.oschina.net/liuguangqiang/blog/2243648

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值