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

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

off999 2025-02-21 14:49 70 浏览 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、首先,打开QQ面板左下角的三个条形图标,然后在弹出选项的“安全”中单击“安全中心主页”。2、然后在打开的QQ安全中心页面中,单击头像下方的“修改密码”。3、然后将弹出一个提示来确认该QQ号码,并单...

win10两台电脑怎么共享文件(win10两台电脑怎么共享文件夹)

在Windows10中,您可以使用以下步骤共享文件:1.在要共享的文件夹上单击右键,选择“属性”。2.选择“共享”选项卡,然后选择“高级共享”。3.在“高级共享”对话框中,选中“共享此文件...

电脑复制粘贴不了是怎么回事

电脑无法复制粘贴原因分析及解决方法:如果是中病毒的话,会有以下的这些情况:1、系统不能上网,例如宽带账号无法登录,qq登录不上,网页无法打开。2、复制粘贴功能失效。3、电脑任务栏上的信息不能显示。4、...

win7一键烟雾头(win7烟雾头设置)

要调整Win7系统的烟雾头,首先需要打开“显示设置”窗口,在这个窗口中可以找到“分辨率”、“屏幕比例”等选项。接着,在“高级设置”中找到“显示适配器属性”选项,点击进入。在这个界面中,可以找到“3D设...

win7系统一键装机下载(w7一键安装操作系统)

可以在温十系统电脑上下载温七装机系统,但需要按照正确的步骤进行安装。以下是一个可能的安装步骤:1.在温十系统电脑上下载温七装机系统的ISO文件,可以从互联网上下载,也可以从其他媒体(如DVD或USB驱...

qq互联管理中心(qq互联管理中心是干什么的)

QQ互联是基于Discuz!云平台的一项服务,因此在开通QQ互联之前首先需要开通Discuz!云平台。在Discuz!X2中已经内置了云平台和相关服务,无需安装,在后台直接开启即可。可以呀,有...

win10新加固态硬盘怎么设置(win10加装固态后需要设置什么吗)

安装固态硬盘后,您可以按照以下步骤设置Win10系统:1.连接固态硬盘:将固态硬盘插入主板上的SATA数据线接口,并使用电源线将其连接到电源供应器上。2.启动电脑:开机后,进入BIOS设置界面。通...

戴尔电脑无法开机怎么解决(戴尔电脑无法开机怎么解决方法)

1、电源故障当遇到戴尔电脑开不了机的情况,首先是检查是否电源问题,看电源和插头是否存在没有插好的问题。可以使用同型号的电源试一下,重插电源之后,看看是否能够开机,如果换别人的电源能开机的话,那就是电源...

新风系统管道安装图片(新风系统安装管道布置)

新风管道安装与验收标准—安装步骤1.按照设计图纸确定新风管道的走向及管道的规格(管径、材质等)。2.截取新风管道要使用专用截管工具,并将断面口的毛刺、毛边打磨光滑,确保截口断面平整且垂直于管轴线。...

win732下载装机版(win732 下载)

32位系统安装方法如下1.下载win732位系统iso镜像到本地,不要放桌面或C盘,右键使用WinRAR等工具2.将win7.gho文件和Onekeyghost工具放到同一目录,比如D盘,不要放C...

惠普平板笔记本二合一(惠普平板笔记本二合一开不了机怎么办)

首先单击Office按钮,在下拉菜单中单击选择“打印”;2.在“打印”对话框中单击勾选“手动双面打印”复选项,再单击打印按钮进行打印;3.Word会先把1、3、5……等单页的内容发送到打印机打印;4....

台式机显卡天梯(笔记本显卡排行天梯图)

丽台显卡性能排行第一的是:丽台QuadroRTX8000第二是:丽台QuadroP620第三的是:丽台QuadroP2000第四是:丽台Quadrop4000第五是:丽台Quadrop1...

win7更换壁纸(win7更换壁纸显示黑色)

1、首先点开桌面左下角的开始按钮然后在弹出的界面中找到控制面板并打开。2、在控制面板界面的个性化专栏中找到在找到屏幕保护程序并打开。3、在打开的新界面中找到屏幕保护程序并将选项更改为“无”保存后就完成...

如何获取windows7正版(如何获得正版win7)

关于这个问题,获得Windows7激活密钥的方法有几种:1.在购买Windows7时,通常会附带一张带有激活密钥的正版产品密钥卡。您可以查看产品盒内的卡片或说明书,以获取此密钥。2.如果您购买...

重装系统win7旗舰版62位(如何用重装系统win7旗舰版)

要重装Windows7系统,可以按照以下步骤进行操作:1.准备计算机:确保计算机已经安装了Windows11操作系统,因为Windows7的兼容性问题可能会影响安装过程。如果计算机上没有安装W...

取消回复欢迎 发表评论: