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

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

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


大功告成!!!

相关推荐

photoshop官方网站进入(photoshop官网入口)

那是因为网站采用了安全加密技术,安装了SSL证书,说明此网站为安全的页面,其信息已经经过加密措施。显示https的网站,网址上还会有显示一个小锁头,也是安全标志。1.先用Photoshop做一个网页图...

windows7旗舰版主机多少钱(windows7旗舰版电脑多少钱一台)

其实这两个版本没有太大的差别,只是功能上有少量差别,旗舰版服务开启的要比专业版本服务开启的多几个,至于朋友们说的专业快速度比旗舰版快,或旗舰版比专业版速度快,个人认为速度都是一样只是功能上的差别,如果...

小米平板(小米平板怎么分屏)

小米平板的简单使用方法:1、首先给小米平板给充电,确保电量充足。2、长按住电源键启动小米平板,进入设备初始设置界面。3、根据屏幕上的提示信息,设置平板电脑联网、绑定小米账号等,直到完成即可正常使用了。...

移动硬盘一直在加载无法读取

移动硬盘电源灯亮说明硬盘有供电,无法识别此移动硬盘时,可按如下步骤进行排查:1)将移动硬盘拔下后,更换硬盘盒再接上确认。2)更换过硬盘盒还是无法识别的话,移动硬盘就损坏了,需要进行更换;3)若更换过硬...

下载软件的app大全(下载软件的app大全免费)

中国最常见的目前是迅雷下载软件。官网可以下载到正常的免费版本。他支持ftphttpbt磁力链接等多种形式的下载。国外的有bitcome。电驴和电骡等多种形式的下载软件。他们都可以满足日常的下载要求,...

wifi贴小程序搭建需要多少钱

回答如下:要搭建自己的WiFi小程序,需要以下步骤:1.获得开发资格:首先需要注册成为开发者,获得小程序的开发资格。2.编写代码:使用微信小程序的开发工具,编写WiFi小程序的前端和后端代码。3....

外网服务器地址(外网服务器地址ip大全)

要弄懂这个问题,你首先要了解什么叫内网,什么叫外网,什么叫服务器,服务器在网络中所扮演的是什么角色,内网:就是指内部网络,窄义上的内网就是指中小型的局域网外网:就是指在你办公网络之外能访问到的网络...

360卸载不了的软件怎么办(用360卸载软件卸载不了)

开启了自我保护,关闭即可。解决方法如下:准备材料:360安全卫士、电脑1、在电脑上打开安全卫士,进去之后,点击右上方的列表图标,选择设置,2、进去安全卫士设置界面之后,点击安全防护中心,3、进去安全防...

联想电脑u盘启动不了(联想电脑为什么u盘启动不了)
联想电脑u盘启动不了(联想电脑为什么u盘启动不了)

1,启动计算机,并按住DEL键不放,但是也有按其它键的,所以请根据提示,直到出现BIOS设置窗口。2,键盘方向键向右移动到BIOS"Startup"菜单,然后选择“CMS”按回车键,然后选择"CMS"里面的Enabled。3,在对上面的操作...

2026-01-03 02:03 off999

海马苹果助手官方下载(海马苹果助手官方正版)

除了官方版,苹果其他服务器互通吧好像,只是不能换服务器登录你好;根据你的提示,可能是你的手机系统不正常蚂蚁浏览器,你可以现在一个手机QQ浏览器,它的体积小,功能强大,还特别的节省流量,它使用自主研发的...

wifi恢复出厂设置后上不了网

恢复出厂设置后,路由器的网络设置也被清空了,需要重新设置账号和密码等信息并配置网络。还需要确认路由器的网线连接是否正确,以及是否有其他网络设备干扰。 如果重新配置还是连不上网不能用,可能需要...

联想笔记本蓝屏怎么解决(联想笔记本蓝屏怎么解决方法)

回答如下:如果您的联想笔记本电脑出现蓝屏问题,可以尝试以下解决方法:1.重启电脑:尝试简单的重启电脑,看是否可以解决问题。2.检查硬件:检查您的笔记本电脑是否有硬件故障。例如,您可以拔下所有外接设...

微星显卡型号档次梯队(微星显卡大全)

2019年微星新出的显卡主要系列划分:VENTUS(万图师):入门级版本,也有人说是丐版,用料一般。ARMOR(装甲师):中低版本,做工用料主流,比丐版强一点。DUKE(暗黑龙爵):中等版本,做工用料...

腾达扩展器a12设置(腾达扩展器设置方法)

1、检查扩展器的WiFi是否正确无线扩展器连接的是上端的WiFi,然后再转发出新的WiFi。所以,必须要知道正确的上端WiFi信息,比如WiFi名称和密码。解决方法:用手机连接上端WiFi,登录到这个...

手机文件彻底删除如何恢复(手机里文件删了怎么恢复)
  • 手机文件彻底删除如何恢复(手机里文件删了怎么恢复)
  • 手机文件彻底删除如何恢复(手机里文件删了怎么恢复)
  • 手机文件彻底删除如何恢复(手机里文件删了怎么恢复)
  • 手机文件彻底删除如何恢复(手机里文件删了怎么恢复)

取消回复欢迎 发表评论: