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

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

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


大功告成!!!

相关推荐

驱动人生下载限速解除(驱动人生限速解除最简单方法)

可以设置双工模式试试:在桌面右键网上邻居,单击属性,跳出对话框,再右键本地连接,单击属性,在跳出的对话框中单击配置选项卡,再单击高级选项,在属性对话框中选中“连接速度和双工模式,”在右面值的对话框中选...

电脑运行慢换什么配件(电脑特别慢换什么硬件)

  要提高电脑游戏性能,应提升cpu、内存、显卡的配置,硬盘也是系统的一个瓶颈,因此升级建议如下:  1、cpu可升级为翼龙2四核x495595wTDP功耗;  2、内存可添加2Gddr3...

免费的微信数据恢复软件(免费的微信数据恢复软件下载)

可靠,微信数据恢复管家是一款非常好用的数据恢复软件,用户们能够在这里自由的恢复手机中的数据,包括了各种微信聊天数据、图片、短视频等等,非常的可靠。可靠。微信聊天记录恢复软件是真的。 有备份:...

windowsinstaller重装(window 重装)

原因:安装的版本起了冲突。1、测试时候电脑已安装office2016-zh-cn,准备安装visio2016。先右键点击visio2016版本,选择管理员模式进行安装。2、安装时候就会提示各种问题...

iso镜像如何安装win7(iso镜像安装教程)

可采用以下两种方法:方法1,进入BIOS,关闭SecureBoot,启动CSM或者是选择LACY引导。用U盘带的分区工具,以MBR模式进行分区,把你的WIN7镜像GHOST到活动分区。不过你的WIN...

win7模拟器破解版(win7模拟器.apk)

启动模拟器之后,找到设置图标点击进入。2点击显示。3取消自动旋转屏幕的勾选。因为在电脑上使用android模拟器,不存在自动旋转屏幕的效果的模拟,所以这个功能对于模拟器是什么用的。而且如果模拟...

word密钥激活码2016(word 2016激活码)

1、office2016包含word、excel、powerpoint等组件,直接使用office2016密钥就能激活word2016。2、如果你安装的是word2016独立组件,也有独立的word2...

360重装系统只是重装c盘吗(360重装系统需要u盘吗)

在选择还原盘符时,软件默认为C盘,只要不是误操作或刻意为之,则系统只会安装到C盘。在安装系统完成后,先安装安全软件如360安全卫士加360杀毒或者金山毒霸之类其它安全软件,进行全盘查杀木马、病毒,再打...

电脑不断的重启是怎么回事(电脑在不断重启怎么回事)

1、系统出现问题系统如果丢失文件,缺少某种关键的注册表信息的话,是会出现不断重启的现象的。这种情况我们只需要重装系统即可。2、电脑硬盘损坏硬盘如果出现坏道,进水也会出现不断重启的现象。这个时候我们就需...

联想小新700(联想小新700电竞版配置)

小新700-15isk采用15.6英寸1920x1080分辨率全高清IPS雾面防眩光屏,通过莱茵TUV低蓝光认证,全段DC调光无频闪,100%sRGB的高色域覆盖,300尼特,摄像头升级至1080P全...

手机声卡软件免费下载(手机声卡软件有哪些)

要下载和安装声卡驱动程序,您可以按照以下步骤进行操作:1.确定您的声卡型号和制造商。您可以在计算机的设备管理器中找到这些信息。2.访问制造商的官方网站。在其支持或驱动程序下载页面上,搜索您的声卡型...

tplogin管理员初始密码(tplogincn管理员默认密码)

admin。tplogincn管理员密码是admin。tplogin.cn是TP-Link(普联)无线路由器的管理页面地址,页面中需要输入的管理员密码是admin。注意:如果输入admin后路由器没有...

nvidia驱动更新在哪里(nvidia驱动更新有用吗)

N卡显卡驱动可以在官网更新。通常情况下,N卡显卡的驱动可以通过官方网站进行更新,它们会定期发布新的驱动程序以解决已知或新发现的问题,而且官网更新的驱动程序可以有效地解决很多显卡问题。此外,如果您不知道...

u盘量产工具安卓版(u盘量产工具使用教程)

万能u盘量产工具。金士顿U盘量产工具可以改写U盘主控芯片数据实现U盘量产还原修复的功效。用户只需要将U盘插入计算机,使用金士顿U盘修复软件扫描修复和量产即可恢复。原理是重写和还原U盘的主控芯片数据,让...

ghost纯净版哪个网站(ghost 正版)

windows7ghost纯净版特色:1、专业为电脑制作,定制版系统使笔记本电脑运行更加可靠。2、安装盘经过多名电脑安装人员测试,稳定性和兼容性非常好。3、通过多台不同硬件型号的计算机测试,没有蓝屏,...

取消回复欢迎 发表评论: