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

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

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


大功告成!!!

相关推荐

win7如何进入bios界面(Win7如何进入bios界面)

在Win7开机时进入BIOS设置是通过按下特定的按键来实现的。不同的计算机品牌和型号可能需要不同的按键组合来进入BIOS设置,请注意电脑启动时屏幕上的提示信息,通常会显示要使用哪个按键来进入BIOS。...

装机配置表(装机配置表格下载)

处理器+主板:I39100+技嘉B360M套装1179散热:九州风神玄冰40099显卡:核显内存:金士顿dr426668G279固态:三星250GB860EVO(SATA3.0)33...

apple id怎么找回密码(Apple ID怎么找回密码没有苹果手机)

可以用ID找回密码。因为在注册Apple账号时必须要添加邮箱或手机号码,所以当忘记密码时,可以通过输入该账号的邮箱或手机号码来找回密码。具体步骤为:在登录页面点击“忘记密码”,选择“使用其他方式找回”...

电脑磁盘受损怎样修复(电脑磁盘损坏)

方法一:一般问题修复  1.硬盘坏常的现象是开机或运行时容易蓝屏,但还是能进系统。这个问题一般比较的容易修复,主要是系统分区出问题了。我们打开DOS命令提示符窗口,输入命令“chkdskc:/f...

mac地址在哪里查(mac地址在哪里查找啊)

查看电脑MAC地址的五种方法如下:方法一:通过命令提示符查看点击“开始”菜单,在“搜索程序和文件”输入框中输入“cmd”,然后回车。回车后,弹出命令符窗口,输入“ipconfig/all”,然后回车。...

win10u盘系统盘制作(win10u盘做系统详细步骤)

要用U盘制作一个Windows10系统盘,您可以按照以下步骤进行操作:1. 准备一个至少8GB容量的U盘,并确保其中没有重要数据,因为制作系统盘会将U盘格式化。2.&n...

电脑怎么更新win10(电脑怎么更新浏览器)

windows10升级版本方法如下一、首先,打开要更新的电脑,进入win10系统,在桌面左下角点击“开始”按钮。二、然后,在“开始”菜单中点击“设置”点击打开。三、然后,在电脑设置中选择“更新与安全”...

联想电脑恢复出厂设置系统(联想系统恢复出厂系统)

1.打开电脑,鼠标点击屏幕左下角的【开始】图标,再点击【设置】图标。  2.进入【Windows设置】界面后,点击【更新和安全】-【恢复】。  3.点击【重置此电脑】下的【开始】按钮,根据需要选择【保...

手机版爱思助手app下载苹果版

第一步:我们先在电脑上安装好爱思助手,并且把手机与电脑连接起来;  第二步:在电脑上打开爱思助手以后,点击顶部的“软件资源”栏目;  第三步:随后在软件资源列表中即可看到“爱思助手”应用,点击...

ie浏览器图标删除不了(ie浏览器从桌面无法删除)

  方法一:  1、点击“开始”,在搜索中输入“gpedit.msc”回车打开注册表;  2、点击“用户配置-管理模板-桌面”左侧的下拉按钮;  3、单击”桌面“,右侧弹出桌面的设置栏;  4、双击“...

bitlocker是什么意思(bitlocker属于什么锁)

Bitlocker的意思:驱动器加密;磁盘加密;硬盘加密。BitLocker驱动器加密它是在WindowsVista中新增的一种数据保护功能,主要用于解决一个人们越来越关心的问题:由计算机设备的物理...

win10开机启动文件夹在哪里(电脑开机启动文件夹win10)

win7下:在运行里打入gpedit.msc然后回车。用户配置-〉管理模板-〉系统点击右边“只运行指定的windows程序”点击允许的应用程序列表显示按钮在里面添加需要运行的程序,...

如何升级win11专业版(升级win11专业版会删掉东西吗)

简单来说,目前升级到Windows11系统上,有三种常见方法:1、通过微软推送更新,从Windows更新升级。2、更新不求人,通过Win11更新助手升级。助手更新系统也非常简单省心。3、无视硬件限制...

office2007支持win10吗(office2007支持win7吗)

1不兼容2Office2007和Windows10之间存在一些兼容性问题。Office2007是较旧的版本,而Windows10是较新的操作系统。因此,某些功能可能无法在Office20...

rar解压软件pc版(pc端rar解压软件)
  • rar解压软件pc版(pc端rar解压软件)
  • rar解压软件pc版(pc端rar解压软件)
  • rar解压软件pc版(pc端rar解压软件)
  • rar解压软件pc版(pc端rar解压软件)

取消回复欢迎 发表评论: