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

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

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


大功告成!!!

相关推荐

三星 官网(三星 官网免费查询)

答:三星官网售后服务官网:http://support-cn.samsung.com/support/ServiceLocations.asp国家工信部电信设备进网管理网站查询移动设备真伪方式:方法一...

win8为什么不流行(为什么没有win8系统)

win8系统好用  1、更美观:  win8比win7以及XP更美观方便,开始界面能直接打开运行App程序。win8系统主要是为了让平板电脑用户使用效果更加友好,更加人性化,所以界面以metro界面为...

装完系统的u盘如何还原(装了系统盘的u盘怎么恢复)

u盘重装系统恢复原样方法如下1、直接把U盘格式化:另外再找一台电脑,插入U盘,电脑能识别就直接格式化。2、如果U盘在别的电脑无法识别,那么解决办法是:把U盘插入电脑,然后运行ultraISO,再点击...

手机如何注册邮箱账号(怎么样手机注册邮箱)
  • 手机如何注册邮箱账号(怎么样手机注册邮箱)
  • 手机如何注册邮箱账号(怎么样手机注册邮箱)
  • 手机如何注册邮箱账号(怎么样手机注册邮箱)
  • 手机如何注册邮箱账号(怎么样手机注册邮箱)
服务器系统安装驱动(服务器系统安装驱动怎么安装)

首先根据网卡的型号到主板的官方或是主板的驱动盘上找一下,应该可以找到对应的linux驱动。1确认系统的内核版本[root@localhost~]#uname-r2.6.18-8.el5PAE我的内核版...

126网易免费邮箱登录官网(126网易邮箱登录入口官网)

126邮箱是网易的一个免费邮箱登录入口在浏览器输入:mail.126.com浏览器进入126邮箱网站之后,即可自行登录126邮箱账号网易126免费邮箱-你的专业电子邮局,超过20年的邮箱运营经验,系统...

iis安装步骤win7(iis安装步骤 windows server 2016)
  • iis安装步骤win7(iis安装步骤 windows server 2016)
  • iis安装步骤win7(iis安装步骤 windows server 2016)
  • iis安装步骤win7(iis安装步骤 windows server 2016)
  • iis安装步骤win7(iis安装步骤 windows server 2016)
连wifi神器哪个最好(连wifi软件哪个好用)

水星的更好。如果需要支持最新无线协议WIFI6的路由,可以选择水星X18G,全千兆网口,双频并发,无线速率1800M,有端口盲插功能,对小白很友好;采用最新的MU-MIMO技术,在多用户环境下,每个...

电脑蓝屏了怎么办修复0x0000007b
  • 电脑蓝屏了怎么办修复0x0000007b
  • 电脑蓝屏了怎么办修复0x0000007b
  • 电脑蓝屏了怎么办修复0x0000007b
  • 电脑蓝屏了怎么办修复0x0000007b
boot manager是什么意思(boot,manager)

1.长按电脑开机键,强制性关机;2.按开机键打开电脑,当看到电脑主板LOGO的时候按对应的Bios启动快捷键(每个主板不大一样请自行查询进入BIOS的快捷键)进入BIOS;3.找到启动(Boot)菜单...

笔记本安装打印机步骤(笔记本安装打印机步骤是什么)
  • 笔记本安装打印机步骤(笔记本安装打印机步骤是什么)
  • 笔记本安装打印机步骤(笔记本安装打印机步骤是什么)
  • 笔记本安装打印机步骤(笔记本安装打印机步骤是什么)
  • 笔记本安装打印机步骤(笔记本安装打印机步骤是什么)
hp laserjet1020打印机驱动(hp laserjet1020手机驱动)
hp laserjet1020打印机驱动(hp laserjet1020手机驱动)

1、用USB线缆连接惠普LaserJet1020打印机和个人计算机。线缆两端的接头一扁一方,扁的一头连个人计算机,方的一头连打印机。小提示:打印机的电源开关位于背面,先不用打开。  2、将随打印机附带的驱动光盘放入个人计算机的...

2025-12-11 13:51 off999

win10最早版本是哪个(win10早期版本)

一般WINDOWS10是家庭版或专业版。因为WINDOWS10作为微软公司的新一代操作系统,具有不同版本,家庭版和专业版是最为常见的版本,两者在功能和适用场景上有所不同。家庭版适用于家庭用户和学生...

360网页版(网页版360浏览器网址)

1、首先打开电脑浏览器。2、然后在浏览器上搜索搜索360网盘。3、然后就可以看到网页版登录入口。4、最后点击进去就可以输入账号密码,登录360云盘了。5、登录成功后,就进入到云盘主界面中。就可以进行文...

电脑最新系统下载(电脑安装最新系统版本)

系统文件格式有exFAT、NTFS、FAT等,不同的磁盘格式有不同的特性。1:exFAT、NTFS、FAT分区的比较exFAT优势明显1.支持非常大的文件和存储设备.2.对性能的改进支持。3.对未来的...

取消回复欢迎 发表评论: