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

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

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


大功告成!!!

相关推荐

哪个网站可以免费下载歌曲(什么音乐软件可以免费下载歌曲)

有,如下:一、http://51Ape.Com一个免费提供无损音乐下载的网站,专注于Ape音乐、Flac音乐以及Wav等各类高品质无损音乐的免费下载,是目前国内比较好的免费音乐下载网站。二、91听歌网...

手机解压exe文件的软件(手机exe文件解压器)

方法如下:1、在手机页面点击"阿里云盘"APP。进入后,选择点击打开压缩包文件。2、在压缩包文件的打开界面中点击在线解压选项。3、在解压界面中点击右上角的全部解压选项。4、在跳转的界面...

2025三幻平民推荐阵容(2021三幻平民推荐阵容)

2024赛事通行证的幻军之幻保底为10张,这个数字是由官方确定的。幻军之幻保底是指在购买一定数量的抽卡券后,保证至少可以获得10张幻军之幻,即使在此之前已经抽到了其他卡牌。这种保底机制增加了用户在购买...

360抢票软件还能用吗(360抢票还可以用吗)

1、建议安装360安全浏览器抢票专版才能进行抢票;2、如果浏览器版本低建议更新版本,会避免验证码错误。3、用360手机浏览器抢票专版,绑定手机后,成功率提高100%。...

迅游手游加速器下载(奇游手游加速器)

1、首先,我们需要下载迅游手游加速器官方最新版本(点击下载)2、下载成功后,打开迅游手游加速器,搜索找到《英雄联盟:激斗峡谷》手游,然后进行安装即可。3、安装成功后,在迅游手游加速器客户端找到《英雄联...

yy2080(yy2080歌手排行)

1.是最早的YY语音频道之一,也是最早娱乐K歌频道,创办于2008年6月。2.历史沉淀,聚集了很多人气型歌手,使得人力资源在YY界独占鳌头。3.考核制度深严,所以内部成员在能力较强的情况下,具有一定爱...

科兴中维新冠疫苗(北京科兴中维新冠疫苗)

合格。国家有各种疫苗的审核标准,达到标准后才可以接种。国家不可能让不合格的疫苗,进入接种环节。这点大家可以放心!不是新冠疫苗一般指新型冠状病毒疫苗。一般情况下,新型冠状病毒疫苗成都生物不是科兴。具体分...

咪咕视频app下载(咪咕视频app下载官方正版)

咪咕视频下载一般都是保存到本地的,也就是说,安装咪咕视频下面的这个文件里面进行下载的,如果你需要变更到其他地,文件夹里面需要你变更一下保存地址,一般是直接下载到本地的,是默认的,不需要更改,只是如果用...

夸克浏览器app官方下载正版(夸克浏览器app官方下载正版免费版)
夸克浏览器app官方下载正版(夸克浏览器app官方下载正版免费版)

1.以win10为例,借用腾讯应用宝即可。点击打开腾讯应用宝2.搜索栏输入"夸克"→点击夸克旁的安装3.夸克正在安装中4.夸克成功安装并打开成功...

2026-01-26 05:43 off999

免费杀毒软件的排名(免费杀毒软件的排名有哪些)

1.360杀毒,品牌介绍:360安全卫士品牌是一款由奇虎360公司推出的功能强、效果好、受用户欢迎的安全杀毒软件。360安全卫士拥有查杀木马、清理插件、修复漏洞、电脑体检、电脑救援、保护隐私,电脑专家...

手机上最好用的五笔输入法(手机五笔输入法推荐)

作为一款手机输入法,五笔输入法在中文输入中起着举足轻重的作用。但是,市面上五笔输入法种类繁多,如何选择一款好用的五笔输入法呢?首先,好用的五笔输入法需要具备高效的输入速度和准确度。其次,输入法要有丰富...

stimulate(stimulate sb to do sth)

是高中单词。中文意思是促进常见释义英[?st?mjule?t]美[?st?mjule?t]vt.促进;激发;激励;刺激;使兴奋;促进(身体某部分)的功能;例句Thewomenweregiven...

排名第一的传奇手游(排行榜第一的传奇游戏)
排名第一的传奇手游(排行榜第一的传奇游戏)

1、《原始传奇》原始传奇是一款主打原汁原味传奇的手游,游戏当中还是延续了传奇特别经典的地图以及游戏副本,游戏里面的各种技能、人物也都是大家很熟悉的样子,绝对是很棒的传奇手游,游戏整体玩法也很轻松,任务副本也不是很多,游戏操作方面也不是太难,...

2026-01-26 04:43 off999

office免费下载电脑版(电脑免费下载office2016)
office免费下载电脑版(电脑免费下载office2016)

据了解,电脑上免费版的office软件主要有:1、金山WPS:可以说是免费的Office产品中发展得最好的Office了,可以实现办公软件最常用的文字、表格、演示等多种功能。2、Openoffice:是一个跨平台多语言的Office套件...

2026-01-26 04:15 off999

qq浏览器极速版(qq浏览器极速版官方正版下载)

1.可以领取红包的浏览器有很多,其中比较受欢迎的包括谷歌浏览器、火狐浏览器、360浏览器等。这些浏览器都提供了相应的插件或者应用,可以在购物、支付等网站中自动搜索并领取优惠券和红包。2.此外,一些...

取消回复欢迎 发表评论: