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

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

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


大功告成!!!

相关推荐

南京华硕电脑售后维修服务网点

没有华硕的授权书,仅仅打了华硕的旗号,信誉度是有水分的.告诉你一个可信的华硕专卖:华海3楼,具体房号忘了.(明天可告诉你)店面不大,只经销华硕产品.------------------------...

win7怎么升级到win8系统(win7怎么升级到win8.1)

可以。具体步骤如下:一.利用小马激活软件或KMS激活软件等激活系统。二.下载官方win10系统到电脑;或者:1.安装腾讯电脑管家,2.打开电脑管家,3.选择工具箱,4.选择其他,5.选择wi...

系统性红斑狼疮会遗传给下一代吗

系统性红斑狼疮具有一定的遗传性,建议最好到当地正规医院风湿免疫科就诊抽血检查一下明确诊断。系统性红斑狼疮是一种自身免疫性疾病,目前阶段还不能治愈,治疗方面主要采取口服糖皮质激素,免疫抑制剂,免疫调节剂...

没有光驱如何重装系统(没有光驱和u盘怎么安装系统)
  • 没有光驱如何重装系统(没有光驱和u盘怎么安装系统)
  • 没有光驱如何重装系统(没有光驱和u盘怎么安装系统)
  • 没有光驱如何重装系统(没有光驱和u盘怎么安装系统)
  • 没有光驱如何重装系统(没有光驱和u盘怎么安装系统)
国药董事长我打7针疫苗无惧病毒丶

国药集团中国生物北京生物制品研究所有限责任公司研发的疫苗,是一种新冠肺炎疫苗。该疫苗已经获得国际认可,世卫组织称其有效率高达79%,适合18岁以上人群接种。需要注意的是,国药疫苗的安全性和有效性需要经...

路由器wan口未连接是什么意思

无线网络连接上了,但WAN口未连接说明路由器可以正常发射wifi信号,但路由器本身没有连接到外网,所以还是上不了网,这种情况需要路由设置成功后才能实现带有WIFI功能的机器无线上网,解决方法如下:一...

可以看youtube的浏览器(youtube外网评论中国)

俄罗斯搜索引擎可以通过以下方式看视频:明确结论:俄罗斯搜索引擎可以通过在网站上搜索视频进行观看。解释原因:俄罗斯搜索引擎的网站提供视频搜索功能,用户可以在搜索框中输入关键词进行搜索,即可找到相关视频,...

惠普bios(惠普bios怎么进入)

  机器型号不同,BIOS程序也不完全相同的,您从惠普官方网站上下载BIOS后,在系统中双击运行程序,根据屏幕提示操作,就可以了。  (1)连接外接电源适配器与电池,使电脑处于稳定供电的状态  (2)...

无线宽带和有线宽带的区别(无线宽带跟有线宽带有什么区别)

1.有区别2.无线网络是通过无线信号传输数据的网络,而有线网络是通过物理线缆传输数据的网络。无线网络的优点是可以随时随地连接,不受地理位置限制,方便移动设备的使用;缺点是信号受干扰影响较大,...

手机目前最强杀毒软件(手机目前最强杀毒软件有哪些)
手机目前最强杀毒软件(手机目前最强杀毒软件有哪些)

目前排名第一的手机杀毒软件是手机管家,这个数据有一个机构已经公布了,你可以到网上了解一下。自己和朋友同事都在用这个手机杀毒软件,它的查杀功能不是一般的好,只要用它来查杀就没有解决不了的病毒,有了手机管家我们根本就不用担心自己手机中病毒了。1...

2026-01-09 07:51 off999

安卓解压缩软件(安卓解压缩软件tv)

手机无法直接解压exe格式的文件。因为exe格式通常是Windows操作系统下的可执行文件,而手机采用的是Android或iOS操作系统,无法直接运行Windows下的可执行文件。需要先在电脑上解压或...

windows7资源管理器无限重启

⒈)首先排除电脑病毒的原因  如果电脑中病毒木马等容易导致病毒程度大量占用系统资源,最终导致系统资源不足,出现资源管理器重启,重启后短暂释放资源,但随着病毒程度又开始大量运行,最终很可能会出现网友描述...

路由大师(路由大师官网下载)

SYS本身闪的频率就比其他慢的这是系统的指示灯,你要检查的是WAN指示灯。有闪的话看看是不是欠费了如果是新买的路由器并且设置好了还是不行那么就是联通的网络比较常见,需要打电话给客服叫他们解开,MA...

u盘中毒怎么彻底杀毒(u盘中毒如何处理)

  1、首先保证电脑上安装有电脑维护软件,这样的软件很常用,下载安装一个在电脑上是必要的。  2、将u盘插入到电脑,这是电脑自动识别u盘并弹出小工具框。  点击查杀,凭这以专项功能将u盘进行杀毒。  ...

安卓手机cpu排行榜(安卓cpu排名)

排在榜单第一位的是高通骁龙888Plus,得分超过了32.3万,相比排在第十位的麒麟90004G的得分领先了6万分;高通骁龙888紧随其后,得分为31.7万,高通骁龙870、865Plus以及8...

取消回复欢迎 发表评论: