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

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

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


大功告成!!!

相关推荐

win98安装教程(win98iso怎么安装)

如何安装windows98  一、具体安装步骤  备份好重要文件之后,就可以安装windows98了。  第一步:启动安装程序。  用户如果原来已安装了windows95/97/98,现在拟对其进行升...

雨林木风win7安装(雨林木风win732位安装教程)

  安装步骤如下:  1、光盘放入光驱,复制光盘上的win7.gho和安装系统.exe到硬盘非C盘的文件夹;(gho文件名可以是其他名字,后缀为gho,体积最大的就是。)  2、双击安装系统.exe;...

win10解绑管理员账户(win10管理员账户怎么取消开机密码)

要解除Windows10电脑上的管理员权限,您需要进行以下操作:1.打开“控制面板”:右键单击“开始”按钮,然后选择“控制面板”。2.进入“用户账户”:在控制面板中,选择“用户账户”。3.点击...

win10家庭版没有组策略编辑器

Win10组策略编辑器找不到怎么办  解决方法  一、win10系统版本本身不提供组策略的功能。  1、运行gpedit.msc直接提示找到gpedit.msc(组策略)。  2、运行MMC,在“添加...

tplogin管理员登录入口(tplogin重新设置密码)

tplogin.cn是新版tplink路由器的登录地址(管理页面地址),在浏览器中输入tplogin.cn,就可以打开tplink路由器的管理页面(登录页面)。具体的登录方法如下:1、打开电脑上的浏...

psp模拟器怎么导入游戏(psp模拟器怎么导入游戏 Vivo手机)

方法如下:1、打开能操作文件的助手软件,用pp链接后点击左下文件,然后点常用目录下的程序用户,会出现ppsspp的文件夹。2、打开ppsspp文件夹,会出来四个选项文件夹,第一个进去后是psp文件夹,...

电脑系统怎样升级(电脑系统怎么升级)

电脑系统升级方法步骤,1、打开电脑,点击电脑左下角的开始菜单,在弹出的菜单选项中选择“控制面板”。2、点击“开始”,点击“控制面板”3、在控制面板中,点击“系统和安全”。4、点击启用或禁用自动更新。5...

win10正版系统下载网站(win10官方下载网站)
  • win10正版系统下载网站(win10官方下载网站)
  • win10正版系统下载网站(win10官方下载网站)
  • win10正版系统下载网站(win10官方下载网站)
  • win10正版系统下载网站(win10官方下载网站)
windows无法激活(windows无法激活有什么影响)

1.如果修复或重新组装了电脑,则可能是安装了不同版本的Windows。或者,如果在修复过程中为电脑使用了其他产品密钥,当使用该密钥的电脑数大于Microsoft软件许可条款允许的电脑数时,该密钥...

新机怎么激活windows10(新机怎么激活电池)
  • 新机怎么激活windows10(新机怎么激活电池)
  • 新机怎么激活windows10(新机怎么激活电池)
  • 新机怎么激活windows10(新机怎么激活电池)
  • 新机怎么激活windows10(新机怎么激活电池)
u盘文件恢复软件免费(恢复u盘数据免费的软件)
u盘文件恢复软件免费(恢复u盘数据免费的软件)

u盘损坏文件恢复方法:1、打开电脑桌面的“计算机”或“我的电脑”。2、然后再找到需要修复的u盘。3、打开“运行”窗口(可以直接按“Windows+R”快捷打开),输入“CMD”并点击“确定”按钮以进入命令提符界面。4、从打开的“命令提示符”...

2025-12-28 22:03 off999

win10蓝屏代码大全以及解决方法
  • win10蓝屏代码大全以及解决方法
  • win10蓝屏代码大全以及解决方法
  • win10蓝屏代码大全以及解决方法
  • win10蓝屏代码大全以及解决方法
电脑uac是什么意思

UAC就是用户帐户控制,在对计算机进行更改之前,用户帐户控制(UAC)会通知您。比如安装软件驱动什么的,默认UAC设置会在程序尝试对计算机进行更改时通知您,但您可以通过调整设置来控制UAC...

笔记本找不到自己家的wifi怎么办

1.笔记本电脑缺少无线网卡驱动,需要下载驱动如果笔记本电脑开机之后,无法显示WiFi网络的图标,这个时候多半是因为电脑缺少无线网卡驱动造成的,有时候自己在清理电脑的时候,不小心清理了驱动程序,便会...

电信宽带办理电话是多少(电信宽带办理联系电话)

电信宽带不一定需要电信手机号码,可以根据自身需要选择,有单独的宽带业务,一般要求预存一定时间的使用费。不过一般包含了宽带、手机号码的融合套餐总体上更优惠,对客户来说更划算。如果有相应需求的话,建议同时...

取消回复欢迎 发表评论: