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

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

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


大功告成!!!

相关推荐

hotmail邮箱还能用吗(hotmail邮箱登录有手机客户端的吗)

这个是可以重新申请的呢除了谷歌国内受限,其他基本都可以正常使用。看个人使用习惯可自主申请相应邮箱:微软outlook、hotmail邮箱;网易邮箱、网易126邮箱;新浪邮箱、阿里邮箱;QQ邮箱、搜狐...

怎么建立局域网(怎么建立局域网内其他电脑文件夹的快捷方式)
  • 怎么建立局域网(怎么建立局域网内其他电脑文件夹的快捷方式)
  • 怎么建立局域网(怎么建立局域网内其他电脑文件夹的快捷方式)
  • 怎么建立局域网(怎么建立局域网内其他电脑文件夹的快捷方式)
  • 怎么建立局域网(怎么建立局域网内其他电脑文件夹的快捷方式)
diskdigger官网入口(diskinfo官网)

打开LaunchCenterPro,创建一个叫Omnifocus的操作组,然后再往这个操作组添加新的操作。如果你要在Omnifocus创建新收件箱项,添加URL到LaunchCenter...

最新英特尔处理器排名(最新英特尔处理器排名第几)

一、英特尔酷睿i7670。这款英特尔CPU采用的是超频新芯,最大程度的提升处理器的超频能力。二、英特尔酷睿i74790kCPU:这款CPU采用22纳米制程工艺的框架,它的默认频率是4.0到4.4Ghz...

电脑怎样激活win10系统(电脑怎么激活window10)
  • 电脑怎样激活win10系统(电脑怎么激活window10)
  • 电脑怎样激活win10系统(电脑怎么激活window10)
  • 电脑怎样激活win10系统(电脑怎么激活window10)
  • 电脑怎样激活win10系统(电脑怎么激活window10)
nvidia旧版本驱动下载(nvidia新版本驱动)
nvidia旧版本驱动下载(nvidia新版本驱动)

没法装,n卡本身不具备装旧版驱动的功能一、首先在本机电脑内鼠标左键双击打开“驱动人生”(若电脑上无此软件,可以在各大软件市场内下载安装)。二、打开驱动人生软件后,点击“立即体检”进行驱动扫描。三、驱动扫描完成后,点击显卡右边的“箭头”打开驱...

2025-12-18 20:51 off999

怎么解开别人的wifi密码(如何解开别人的wifi密码)

别人的无线网络密码是很不容易破解的,如果人家是愿意分享的,可以在手机上下载"Wifi万能钥匙"注册登陆成功后连接其无线wifi1、以现有的技术手段,是没有办法破解WPA的加密方式(现在...

电脑突然关机(电脑突然关机像断电了一样 再也打不开)
电脑突然关机(电脑突然关机像断电了一样 再也打不开)

如果是插电源的电脑开着突然就关机了,可能是线路接触不良或者是没电了,导致的开着就关机了,如果是你的电脑是充电的那一种可能是你的电池的电量用完了或者是电池的线路接触不良导致的开着突然就关机了,你可以排查一下线路。1、如果你使用的是笔记本电脑,...

2025-12-18 19:51 off999

win7重装系统一直反复重启(win7重装系统无限重启)

WIN7的系统装重复了,可以将原安装的系统删除,方法如下:1、如果以前的windows是安装在C盘上的话,点击桌面上的计算机,选中C盘,鼠标右键选择属性;2、点磁盘清理;3、点清理系统文件,点确定;4...

电脑如何格式化sd卡(电脑格式化sd卡,提示写有保护)

要在电脑上格式化SD卡,可以按照以下步骤:1.将SD卡插入计算机的SD卡读卡器中。2.打开“我的电脑”或“此电脑”,找到SD卡在计算机上的驱动器号(比如E盘)。3.右键单击SD卡驱动器,选择“格...

系统检测不到机械硬盘(系统检测不到机械硬盘怎么办)

第一,我们需要确认一下机械硬盘是否连接正常。可以检查一下硬盘的电源线和数据线是否插紧,是否松动或者断开。如果发现有松动或者断开的情况,可以重新插上并确保插紧。如果硬盘连接正常,但电脑仍然无法读取,那么...

路由器管理平台登录(路由器管理平台登录网址)

路由器的用户登录入口地址是:tplogin.cn电信运营商定制款登录地址是:192.168.2.1或者192.168.8.12、华为(容易)路由器华为路由器跟荣耀路由器只有IP地址,没有域名,它是...

directx修复(DirectX修复工具官网下载)

使用DirectX修复工具很简单。首先需要下载并安装工具,然后打开工具并按照界面提示进行操作即可。工具的作用是自动检测系统中可能存在的DirectX问题,并尝试修复它们,从而保证计算机游戏等应用程序的...

网易邮箱app官方下载安装(网易邮箱163)
网易邮箱app官方下载安装(网易邮箱163)

有些东西调用外部下载软件(如迅雷)是无法下载的,有时下载后不能正常打开,请尝试:在所要下载的文件上点击右键,选择“目标另存为”,也许就能成功下载。下载从网易163邮箱发来的云附件的步骤如下:1.成功登录网易邮箱后,我们点击页面左上角的“收件...

2025-12-18 16:51 off999

产品密钥是什么意思(产品密钥有什么用处)

产品密钥是产品授权的证明,有了它才能使用这个产品。软件商在生产自己产品时,为每个产品输入一个序列号(注册号/密钥),如“KH2J9-PC326-T44D4-39H6V-TVPBY”,用户要通过这个序列...

取消回复欢迎 发表评论: