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

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

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


大功告成!!!

相关推荐

腾讯会议下载(腾讯会议下载的文件保存在什么地方了)
腾讯会议下载(腾讯会议下载的文件保存在什么地方了)

1.打开电脑浏览器搜索【腾讯会议】,选择打开软件官网,往下滑动点击【立即下载】。2.在弹出的页面上选择要下载的【安装版本】,支持【windows系统】和【macOS】系统。3.接下来选择文件的【保存位置】,点击【下载】保存安装包。4.下载完...

2026-01-17 11:15 off999

游戏盒子电脑版(电脑板游戏盒子)
游戏盒子电脑版(电脑板游戏盒子)

除了Steam之外,比较有名的电脑游戏盒子有WeGame。WeGame是腾讯游戏平台的升级版本,该平台面向全球及国内玩家,直接将游戏开发者与用户连接起来,为两者创造更多的沟通与互动。WeGame平台提供一站式服务,包括游戏的资讯、购买、下载...

2026-01-17 11:03 off999

欢乐斗地主下载安装(欢乐斗地主下载安装免费 app)

您可以按照以下步骤在华为手机上下载欢乐斗地主游戏:1.打开华为手机上的应用商店(一般为华为应用市场或者AppGallery)。2.在应用商店的搜索栏中输入"欢乐斗地主",然后点击搜...

腾讯游戏全部停服一天(明天腾讯游戏停服一天)

关服停运的游戏通常是没有收益的原因。腾讯游戏通常关服停运的游戏是因为没有成本收益,无法支持游戏的正常运行,所以会进行关服停运,这是最重要的原因。一人之下手游停止运营了,原因是氪金太严重。3年的等待,中...

设置来电铃声50首(免费手机铃声100首)

1.首先找到并点击打开华为手机桌面上的【设置】,2.在设置菜单下点击进入【声音】选项,3.点击【来电铃声】进行设置,如果有两张卡,这里会显示卡1来电铃声、卡2来电铃声,点击选择需要设置电话铃声的卡即可...

10个比1688便宜的拿货网(比阿里巴巴便宜的货源网站)

 比1688便宜的进货渠道有:1、53货源网53货源网主要经营的是3c电子数码。产品的质量及售都是不错的,做3C的朋友可以去看看。2、58食品网该网站主要经营奶制品、饮品等批发;还有许多小零...

诺基亚8800(诺基亚8800e真假图片)

这部手机定位就是高端机,它的做功和机身材质都比较好,用料有皮料,宝石等,还是金属外壳,它卖的不是功能,就是身价,它的定位不同于n73这种街机,价格高买的人就相对比较少,再加上不会大量生产.买8800a...

winkawaks模拟器中文版(winkawaks1.45模拟器)

这个要求汉化包的支持,具体在于WinKawaksRomCenter.dat这个文件要经过汉化才能显示中文的游戏列表。你用英文原版是怎么调也没用的。首先,要下载Winkawaks模拟器软件,然后在模拟...

wps电脑版官方下载(wps电脑版官方下载入口)
  • wps电脑版官方下载(wps电脑版官方下载入口)
  • wps电脑版官方下载(wps电脑版官方下载入口)
  • wps电脑版官方下载(wps电脑版官方下载入口)
  • wps电脑版官方下载(wps电脑版官方下载入口)
木马查杀软件下载(常用的木马查杀工具)

若需鉴定手机是否有病毒,建议您:1.部分手机支持智能管理器(内存管理器),可以通过其中的"设备安全"扫描设备,对设备内存进行检测,查找设备是否存在威胁或有恶意软件。2....

免费ppt软件官方下载(免费ppt软件有哪些)
免费ppt软件官方下载(免费ppt软件有哪些)

1.第一个是优品ppt,首先网站设计的很漂亮,ppt的质量不错,重点是免费;2.第二个是51ppt,里面的模板也都可以免费下载,可以说是非常的良心了,...3.第三个是officeplus,是office的官方网站,出品的模板质量不错,.....

2026-01-17 08:51 off999

免费下载电影的网站(免费下载电影的网站或者app)
免费下载电影的网站(免费下载电影的网站或者app)

电影天堂很多高清电影可以下载1.打开片库网,点击需要下载的影视进入。2.进入到视频播放页面,直接点击屏幕中的下载按钮即可.在电驴里面有这种蓝光电影,你可以去下载。以前用过一个80s电影网,不知道现在还能不能用了,好久没用了,刚出的电影也有的...

2026-01-17 08:43 off999

ie浏览器官网入口(ie浏览器中文版官方下载)

没有手机版本的IE浏览器,所以就没有官方入口这一说法。用户还是使用手机自带的浏览器,或者在应用商店中下载其他的浏览器,比如夸克浏览器、X浏览器、QQ浏览器等等。1、进入手机浏览器,选择三字形的按钮。...

电信宽带测速手机版(中国电信宽带测速器)

可以使用网速测试工具进行测速。一般来说,打开浏览器,输入“速度测试”或“网速测试”等关键词,选择一个网速测试网站进行测速即可。测试时需确保关闭所有下载、上传、在线观看视频等网络活动,以免干扰测速结果...

用自己名字设计logo免费(店名设计logo免费生成器)

进入短信--设置--我的头像选择一照片设置即可微信在名字里加上小图标的步骤如下:1丶打开手机微信,在微信聊天框中输入你包含小图标的昵称,并长按复制。2丶之后点击微信中的设置选项。3丶点击红框中的昵称...

取消回复欢迎 发表评论: