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

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

off999 2025-02-21 14:49 55 浏览 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.在Windows10中设置Edge浏览器为默认浏览器:  a.打开&#...

显卡驱动程序是什么

NVIDIA驱动是一种软件,用于管理安装在计算机上的NVIDIA图形处理器,以确保它们正常运行。NVIDIA是一家知名的GPU(图形处理器)制造商,提供各种高性能显卡和集成GPU,这些设备需要相应的驱...

电脑的网络怎么连接wifi(台式电脑wifi在哪里打开)
  • 电脑的网络怎么连接wifi(台式电脑wifi在哪里打开)
  • 电脑的网络怎么连接wifi(台式电脑wifi在哪里打开)
  • 电脑的网络怎么连接wifi(台式电脑wifi在哪里打开)
  • 电脑的网络怎么连接wifi(台式电脑wifi在哪里打开)
扣扣空间电脑版登录入口(qq空间电脑版官网网站登录)
扣扣空间电脑版登录入口(qq空间电脑版官网网站登录)

可以通过以下链接登陆进入QQ空间:https://qzone.qq.com/QQ空间(Qzone)是腾讯公司于2005年开发出来的一个具有个性空间,具有博客(blog)的功能,自问世以来受到众多人的喜爱。在QQ空间上可以书写日志、写说说...

2025-12-27 22:03 off999

怎么还原(怎么还原手机出厂设置)

1、首先,在Excel工作表中依次点击左上角的文件图标——Excel选项。2、然后,在弹出来的Excel选项的小窗口中点击左侧的保存菜单栏目。3、接着,在保存菜单栏目的右侧可以看到自动恢复文件的位置,...

台式电脑可以设置密码吗(台式电脑如何设密码怎么办)
  • 台式电脑可以设置密码吗(台式电脑如何设密码怎么办)
  • 台式电脑可以设置密码吗(台式电脑如何设密码怎么办)
  • 台式电脑可以设置密码吗(台式电脑如何设密码怎么办)
  • 台式电脑可以设置密码吗(台式电脑如何设密码怎么办)
怎么用360升级系统版本(怎么用360更新系统)

360可以下载补丁更新漏洞,对系统进行升级(在360修复漏洞里面点立即修复就行了)升级电脑系统大多数情况下是指低版本的系统升级到高版本的系统,比如说从windows2000升到xp,从vista升级到...

360助手电脑版客户端(360软件助手电脑)

还是非常好的,都是能够让他可以直接拦截病毒,同时能够让他清理内存,而且能够让这个有非常好的手机应用软件权限优化作用。360手机助手是360推出的手机助手,拥有海量软件和游戏轻松下载,炫彩主题壁纸随心点...

手机360助手官网下载(手机360助手最新版下载)

1、在电脑上安装360安全卫士打开它里边里的360手机助手2、手机设置系统设置——应用程序——未知来源打钩——开发USB调试打钩允许模拟位置打钩3、连接电脑、手机,并打开手机助手4、手机助...

window10安装密钥(win10安装密钥命令)

以专业版为例,win10密钥是由25个字符组成的代码,用于激活windows,根据用户获取windows10副本的方式,需要由25个字符组成的产品密钥或数字许可证才能激活它。数字许可证是windows...

电脑windows7无法连接到网络

解决方法:1、在使用电脑的时候,出现了网络连接不可用的问题,可能造成的原因主要有网络连接被禁用,DNS和IP地址获取不对,网卡驱动损坏,网线没有插好。2、鼠标右键网络连接图标进去,点击更改适配器设置。...

路由器静态ip填什么(路由器的静态ip)

手机登入路由器web界面,输入用户名和密码,第一次弹出设置向导,选择静态ip上网方式,填写可以上网的ip地址,如ip192.168.1.188子网掩码255.255.255.0网关192.168....

台式机显卡怎么安装(台式机显卡如何安装快速回答)
  • 台式机显卡怎么安装(台式机显卡如何安装快速回答)
  • 台式机显卡怎么安装(台式机显卡如何安装快速回答)
  • 台式机显卡怎么安装(台式机显卡如何安装快速回答)
  • 台式机显卡怎么安装(台式机显卡如何安装快速回答)
安装声卡驱动(安装声卡驱动无法找到可支援的驱动程序)
  • 安装声卡驱动(安装声卡驱动无法找到可支援的驱动程序)
  • 安装声卡驱动(安装声卡驱动无法找到可支援的驱动程序)
  • 安装声卡驱动(安装声卡驱动无法找到可支援的驱动程序)
  • 安装声卡驱动(安装声卡驱动无法找到可支援的驱动程序)

取消回复欢迎 发表评论: