百度360必应搜狗淘宝本站头条
当前位置:网站首页 > 技术资源 > 正文

yum安装nignx 添加模块_yum安装的步骤

off999 2025-02-21 14:49 79 浏览 0 评论

目前使用的nginx版本是1.20.1 , 在实现四层反向代理的时候用到stream模块

,但是检查配置的时候报错,没有stream模块,所以写此篇文章记录一下

[root@7-22 ~]# nginx -t
nginx: [emerg] unknown directive "stream" in /etc/nginx/nginx.conf:85
nginx: configuration file /etc/nginx/nginx.conf test failed

步骤一:首先查看自己nginx的版本,然后下载一个和自己版本一样的nginx tar包

[root@7-22 ~]# nginx -v
nginx version: nginx/1.20.1                //检查版本
[root@7-22 opt]# cd /opt && wget http://nginx.org/download/nginx-1.20.1.tar.gz 
   // 把tar包下在/opt 目录下 ,根据个人习惯调整目录
[root@7-22 opt]# tar zxvf nginx-1.20.1.tar.gz     //解压tar包

步骤二:备份原文件、安装依赖

[root@7-22 ~]# mv /usr/sbin/nginx /usr/sbin/nginx.bak
[root@7-22 ~]#  cp -r /etc/nginx  /etc/nginx.bak
[root@7-22 ~]# yum install -y perl-ExtUtils-Embed readline-devel zlib-devel pam-devel libxml2-devel libxslt-devel openldap-devel python-devel gcc-c++   openssl-devel cmakepcre-develnanowget  gcc gcc-c++ ncurses-devel per redhat-rpm-config.noarch

步骤三:进入解压的nginx目录里面,用./configure重新编译安装nginx

[root@7-22 nginx-1.20.1]# ./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=/run/nginx.pid --lock-path=/run/lock/subsys/nginx --user=nginx --group=nginx --with-compat --with-debug --with-file-aio --with-google_perftools_module --with-http_addition_module --with-http_auth_request_module --with-http_dav_module --with-http_degradation_module --with-http_flv_module --with-http_gunzip_module --with-http_gzip_static_module --with-http_image_filter_module=dynamic --with-http_mp4_module --with-http_perl_module=dynamic --with-http_random_index_module --with-http_realip_module --with-http_secure_link_module --with-http_slice_module --with-http_ssl_module --with-http_stub_status_module --with-http_sub_module --with-http_v2_module --with-http_xslt_module=dynamic --with-mail=dynamic --with-mail_ssl_module --with-pcre --with-pcre-jit --with-stream=dynamic --with-stream_ssl_module --with-stream_ssl_preread_module --with-threads --with-cc-opt='-O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -m64 -mtune=generic' --with-ld-opt='-Wl,-z,relro -specs=/usr/lib/rpm/redhat/redhat-hardened-ld -Wl,-E' --with-stream 

报错解决:

1../configure: error: the HTTP image filter module requires the GD library.You can either do not enable the module or install the libraries.

yum -y install gd-devel

2../configure: error: the invalid value in --with-ld-opt="-Wl,-z,relro -specs=/usr/lib/rpm/redhat/redhat-hardened-ld -Wl,-E"

yum -y install redhat-rpm-config.noarch

3../configure: error: perl module ExtUtils::Embed is required

yum -y install perl-devel perl-ExtUtils-Embed

4../configure: error: the Google perftools module requires the Google perftoolslibrary. You can either do not enable the module or install the library.

yum  -y install gperftools-devel

注意://解决完报错别忘了再重新编译,重新执行一遍步骤三

出现类似下面的命令说明编译没问题了

 + perl version: This is perl 5, version 16, subversion 3 (v5.16.3) built for x86_64-linux-thread-multi
 + perl interpreter multiplicity found
checking for Google perftools ... found
creating objs/Makefile

Configuration summary
  + using threads
  + using system PCRE library
  + using system OpenSSL library
  + using system zlib library

  nginx path prefix: "/usr/share/nginx"
  nginx binary file: "/usr/sbin/nginx"
  nginx modules path: "/usr/lib64/nginx/modules"
  nginx configuration prefix: "/etc/nginx"
  nginx configuration file: "/etc/nginx/nginx.conf"
  nginx pid file: "/run/nginx.pid"
  nginx error log file: "/var/log/nginx/error.log"
  nginx http access log file: "/var/log/nginx/access.log"
  nginx http client request body temporary files: "/var/lib/nginx/tmp/client_body"
  nginx http proxy temporary files: "/var/lib/nginx/tmp/proxy"
  nginx http fastcgi temporary files: "/var/lib/nginx/tmp/fastcgi"
  nginx http uwsgi temporary files: "/var/lib/nginx/tmp/uwsgi"
  nginx http scgi temporary files: "/var/lib/nginx/tmp/scgi"

最后

[root@7-22 nginx-1.20.1]# make install     
[root@7-22 nginx-1.20.1]# nginx -t            //再次检查
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful    //可以看到,success


大功告成!!!

相关推荐

成品ppt网站国外(免费生成ppt的网站)

免费ppt成品怎么下载?不确定您要下载哪类的ppt。如果想要下载初中语文课件的话,免费成品ppt可以通过无忧无虑中学语文网下载,上面按照年级,教材版本分门别类的课件资源,教案参考,还有相应的练习题,甚...

免费的连连看游戏大全(连连看游戏app推荐)

在4399小游戏里,点击儿童小游戏,里面就有不及时的连连看。《连连看》只要将相同的两张牌用三根以内的直线连在一起消除即可。连连看,又称对对卡,是指图案配对的一种益智游戏,有多种形式,如卡片游戏、电子...

图片文字提取免费工具(图片文字提取免费工具在线)

1.打开手机,进入图库,点击打开一张图片。2.点击【分享】图标进入页面。3.点击【提取文字】。注意,只有手机已安装WPS才会出现此图标。第一种方法需要用到我们的聊天神器:QQ,进入任一聊天框并给...

一键群发500微信群软件(有没有微信一键群发5000人的软件)
一键群发500微信群软件(有没有微信一键群发5000人的软件)

1/8进入设置打开微信进入个人页面后,点击【设置】。2/8进入通用点击【通用】。3/8进入辅助功能点击【辅助功能】。4/8进入群发助手点击【群发助手】。5/8开始群发点击【开始群发】。6/8新建群发点击下方【新建群发】。7/8选择好友在这里...

2026-01-23 06:43 off999

万能驱动离线安装包(万能驱动离线版win10)

一、驱动人生()1、驱动人生为了针对用户的离线使用需求,专门推出了离线版的软件,能够在没有网络的情况下使用。2、通过内置的网卡驱动程序,帮助用户优先安装网卡驱动,进而可以连接网络并继续在网上下载安装驱...

中国象棋天天象棋(中国象棋天天象棋手机版)

天天象棋中的专区对局就是ai区,也就是软件区,专门给引擎下棋的,以前3.0版本里有,我玩过,没啥特别的,一开始匹配的都是新手,因为那个模式有独立的段位机制,后面更新之后就给禁掉了,跟ai对局没意思,还...

百度图片(百度图片官网)
  • 百度图片(百度图片官网)
  • 百度图片(百度图片官网)
  • 百度图片(百度图片官网)
  • 百度图片(百度图片官网)
苹果恢复大师(苹果恢复大师收费吗)

苹果恢复大师是可靠的苹果手机数据恢复软件,兼容Windows和Mac平台,支持iOS设备上的多种数据恢复和备份,如微信聊天记录,短信,通讯录,照片等,具体操作也是十分简单。苹果恢复大师一共有三种恢复模...

gg修改器下载安装(gg修改器下载安装免root)

OPPO手机下载gg修改器方法如下:可以打开在桌面找的浏览器,我们打开进入,然后再浏览器上面搜索框,搜索GG修改器,找到之后,我们点击GG修改器官网,然后就可以在GG修改器里面的官网下载了,之后我们点...

磁力吧最佳的磁力(磁力吧最佳的磁力是多少)

磁力片玩具是一种可以激发儿童创造力和想象力的玩具,市面上有许多品牌可以选择。在选择磁力片玩具时,可以考虑以下因素:品牌信誉:选择知名品牌,可以更加放心地使用。质量:质量好的磁力片玩具可以使用更长时间,...

文件恢复(文件恢复大师是真的吗)

方法一:从回收站恢复删除文件回收站是操作系统提供的一个文件夹,用来临时存放用户删除的各种数据。存放于回收站中的资料,可以被还原到删除之前的原始位置,也可以从回收站中删除。因此,回收站给用户提供了一个&...

腾讯怎么找到真人客服(微信怎么直接打人工)
  • 腾讯怎么找到真人客服(微信怎么直接打人工)
  • 腾讯怎么找到真人客服(微信怎么直接打人工)
  • 腾讯怎么找到真人客服(微信怎么直接打人工)
  • 腾讯怎么找到真人客服(微信怎么直接打人工)
世界公认十大手游排行榜(全球排名第一的游戏)
世界公认十大手游排行榜(全球排名第一的游戏)

传奇十大金牌指挥:霸气王者战犯、布拉格佛祖、乱世征战英豪、传奇人物深蓝、湖北焦点、傲天メ皇霸道、湖南小三、湖南鱼刺、湖南求剑客、江西小毛拓展资料:《热血传奇》是盛趣游戏2001年推出的一款大型多人在线角色扮演游戏(MMO...

2026-01-23 04:15 off999

英语单词记忆方法技巧(英语单词记忆方法技巧操场怎么写)

记单词的方法很多,比如直拼法、拆分法、增减字母法、对比记忆法、构词法、联想记忆法、分类记忆法、以旧带新法、语境记忆法等。接下来具体介绍五种快速记忆法。直拼法直拼法也叫自然拼读法。是英语单词记忆比较省力...

好玩的仙侠手游(好玩的仙侠手游推荐)

回答如下:以下是一些好玩的仙侠手游:1.《剑网3》:这是一款非常受欢迎的仙侠手游,玩家可以在游戏中选择不同的门派进行修炼和战斗。2.《永恒纪元》:这是一款仙侠题材的ARPG手游,玩家可以选择不同的角色...

取消回复欢迎 发表评论: