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

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

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


大功告成!!!

相关推荐

office2007免安装绿色版(office2007绿色完整版)

把你的绿色版删除!附件的压缩包里有微软提供的卸载程序!运行一遍就可以了!office2007哪个版本好?针对office2007哪个版本好,office2007的版本主要有office2007官方下载...

魔兽官方对战平台(魔兽官方对战平台什么时候回归)

魔兽争霸的对战平台每个时间段都不一样。以前最后的就是浩方队员平台,还有QQ对战平台,后来又出来了vs对战平台。其中开始的浩方平台高手多,后来vs平台出来后大量高手都跑过去了,QQ平台一般菜鸟比较多。...

三国策略手游(三国策略手游试玩)

率土之滨官方版是一款超级好玩的全新策略三国竞技冒险手游,高清质风格的游戏画面能够带你体验全新的策略战斗,高度自由的竞技玩法,玩家可以在游戏中打造属于自己的三国世界1、《极无双》:3D动作军团征战手游《...

在线音频转换器(在线音频转换器Audio)

音频转换器是一种工具,它可以将一个音频格式转换成另外一个格式。使用它非常简单,首先打开音频转换器软件,然后选择需要转换的音频文件,设置输出格式和参数,最后点击转换按钮即可完成转换。注意,在设置输出格式...

拼音输入法哪个最好用(电脑打字常用输入法)

拼音输入法推荐使用谷歌拼音输入法。谷歌的拼音输入法,有五大特色:智能输入:选词和组句准确率高,能聪明地理解您的意图,短句长句,随想随打。时尚语汇:海量词库整合了互联网上的流行语汇和热门搜索词。...

ps软件官方免费下载电脑版免费

1:点击下载好的安装包先进行解压,然后点击“Photoshop_CS6_CHS_lite.exe”文件2:在弹开的界面中点击“自定义安装”,这里小编说明一下,如果用户选择“快速安装”的话,那么软件的安...

传奇盒子平台大全(传奇盒子赚钱)

在996传奇盒子中,会员玩家可以在“我的游戏”中通过“云玩”进入之前体验过的传奇游戏,开启挂机模式后,就能在“云多开”系统里观察到自己的云设备和正在进行云游戏状态的传奇游戏,如果点进手机后台,还能看到...

pdf查看软件(查看pdf格式的软件)

pdf当然可以有查找功能:1、第一步:首先我们要使用WPSOffice打开PDF文档。2、第二步:我们需要依次点击“开始”--->“查找”(或使用快捷键“Ctrl+F”)。3、第三步:我们在查...

中国象棋下载安装(下载中国象棋官方版)

不用刻意下载个中国象棋APP,只需要下载一个QQ游戏,里头就有中国象棋玩了,里头点开后,自动下载,还可以连接其他玩家,一起玩,切磋棋艺。你这问题太模糊了。。。是你有一个象棋游戏,想放到桌面上,双击就可...

手机bt下载软件哪个好(手机有什么下载bt的软件)

磁力下载app推荐黑科技APP,这个好用黑科下载器APP也是一款功能强大且使用的下载类工具应用,它支持磁力以及种子文件的下载。还可以把下载的的文件转存到云盘,并支持在线的云播预览功能,无需等待能直接边...

狂野飙车9下载(狂野飙车9下载入口)

您可以在AppStore搜索“狂野飙车9”或者直接使用Safari等浏览器搜索“狂野飙车9官方下载”,进入官网下载页面,点击下载按钮并根据提示进行下载安装即可。在下载前请确保您的苹果设备已连接稳定...

免费相册视频制作软件(怎么把拍的照片做成视频)
免费相册视频制作软件(怎么把拍的照片做成视频)

电脑端1.会声会影会声会影上手简单而且做出的相册的效果也很不错,很适合新手使用,x7以前的版本都是可以自己去免费用的。2.premiere(pr)pr是一款比较专业的视频剪辑制作软件,用它来做电子相册也是很不错的,做出的效果很高大上,如果只...

2026-01-17 21:43 off999

图片文字修改神器免费(手机无痕修改图片文字软件)

首先区分是完整图片导入还是ai软件自己编写的文字,如果导入的图片无法修改,只能像ps一样去修图,如果是软件编写的,无法选取先要解锁,方法:上面任务栏对象-选择全部解锁。然后修改。修改方法:如果对方编组...

开户最忌三个证券公司(随便哪个证券公司开户都一样吗)

在不同的证券公司开户,确实存在一些区别。首先,不同的证券公司提供的交易品种和交易费用可能不同,有些公司可能提供更广泛的投资选择,而有些公司则可能提供更低的佣金率,这直接影响到您的投资成本和收益。其次,...

农行手机银行app下载(中国农业银行App下载)

自己下载的农行手机银行是能转账的,只是额度可能会要低一些,比如一类卡,在农行网点注册下载并开通手机银行,一天转账的额度是有十万,而自己下载注册开通的手机银行额度则只有5万,自己是可以下载农行手机银行是...

取消回复欢迎 发表评论: