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

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

off999 2025-02-21 14:49 74 浏览 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


大功告成!!!

相关推荐

cad官方正版下载(cad官方正版下载入口)

要下载CAD电脑软件,首先需要找到可靠的CAD软件提供商的官方网站。在官方网站上,您可以找到下载CAD软件的链接。点击链接后,您将被引导到下载页面,选择适合您操作系统的版本。然后,点击下载按钮开始下载...

pptv下载(pptv下载速度慢怎么解决)

步骤/方法1、请到http://www.pptv.com首页,点击“免费下载”2、点击“保存“3、选择存放“PPLive网络电视”的位置,点击“保存”4、等待“PPTV网络电视”下载完成5、下载完成...

群发助手软件(群发助手软件怎么用)

  很多微友一般的做法都是建立微群。而微信群的人数也有限制,同时是多人的聊天,谈不上群发消息,只能说是群聊。如果使用微信自带的群发助手就可以实现一对多的群发消息给好友,那么微信群发助手在哪里呢?下面就...

google store(googlestore应用商店)

很好,我无法为您提供谷歌商店网页版的登录入口。因为谷歌商店是谷歌公司旗下的在线购物平台,仅支持访问外网进行访问,在国内无法直接访问。同时,谷歌商店也并未提供官方登录入口。如果您需要访问谷歌商店,建议您...

荒野大镖客2下载手机版(荒野大镖客2下载手机版官网)
  • 荒野大镖客2下载手机版(荒野大镖客2下载手机版官网)
  • 荒野大镖客2下载手机版(荒野大镖客2下载手机版官网)
  • 荒野大镖客2下载手机版(荒野大镖客2下载手机版官网)
  • 荒野大镖客2下载手机版(荒野大镖客2下载手机版官网)
在线ps网页版(在线ps网页版手机免费使用)
在线ps网页版(在线ps网页版手机免费使用)

1.PS在线是指在互联网上使用PS(Photoshop)软件进行图像处理和编辑的一种方式。2.原因是PS是一款功能强大的图像处理软件,可以进行各种图像编辑、修饰、合成等操作,因此在互联网上提供了在线版本,方便用户随时随地进行图像处理。3...

2026-01-17 03:51 off999

xy苹果助手下载手机版(xy苹果助手ios版)

1、先在没越狱的iPhone手机上下载XY苹果助手。2、点击打开XY苹果助手并信任软件。3、在XY苹果助手的必备里点击下载按钮下载安装必备软件应用。4、特定的具体软件应用,可以在XY苹果助手里使用搜索...

魔兽争霸3冰封王座官网下载(魔兽争霸3冰封王座1.20e中文版下载_魔兽争霸3下载)

没法下载,因为没有说明在什么平台下载可以在网易的官方网站上进行下载,下载地址如下:https://dz.blizzard.cn/下载的时候请选择中间的“平台完整版”,这个版本包含了《魔兽争霸3》游戏本...

四人麻将(四人麻将图片)

1.标准打法:常规的打缺打法,不附加任何的特殊规则。2.标准下雨:在标准打法的基础上,加入下雨的功能,也就是杠牌。下雨分为明杠和暗杠。明杠:①玩家手中有三张一样的牌,其它玩家打出了第四张一样的牌,...

美图秀秀app下载安装免费(美美秀图手机版下载)

美图秀秀下载了找不到,应该是因为你的内存的原因,安装失败了。美图秀秀是一款使用很普遍的美图软件,可以满足大多数用户的需求,比如自己p图,或者是拼图都很好。可是,你发现你下载了美图秀秀,却在手机桌面没有...

街机游戏厅app(街机游戏厅app大全)

以下是几个不错的iOS街机游戏厅:MAME4iOS:这是一款非常流行的iOS街机游戏厅,可以让你在iPhone或iPad上运行多个街机游戏。iCade:这是一款专门为iCade控制器设计的街机游戏...

海外加速器下载(加速器中国免费)

迅游不能下载海外游戏的原因是因为一些海外游戏需要进行版权验证,而迅游没有获得这些游戏的版权许可。此外,由于不同国家的游戏法规和政策不同,迅游有时需要根据不同的规定进行调整,这也可能会限制用户下载一些海...

日语输入法app下载(simeji日语输入法官网下载)

谷歌输入法。安卓可以用的最好用的了吧,在设置里下载好所需要语言,打字时按那个切换即可。另外还有一个触宝,个人觉得不如谷歌。可以打出日文的输入法,很不错的日语输入法。安装后请在系统中添加输入法,即可使...

字体设计网站(字体设计 网站)
字体设计网站(字体设计 网站)

那就到这个网站,每次只能输入一个字,从小篆到甲骨文:http://www.internationalscientific.org就玩个静态页,很简单啊,教你一个作弊方法(反正你来这里讨教也不是自己完成作业),就是找一个你认为合适你作业要求...

2026-01-17 01:51 off999

windows7旗舰版下载地址(win7官方旗舰版下载教程)
windows7旗舰版下载地址(win7官方旗舰版下载教程)

最简单的方法就是,下载完镜像文件后,直接把镜像文件解压,解压到非C盘,然后在解压文件里面找到setup.exe,点击运行即可。安装系统完成后,在C盘找到一个Windows.old(好几个GB,是旧系统打包在这里,垃圾文件了)删除即可。扩展资...

2026-01-17 01:43 off999

取消回复欢迎 发表评论: