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

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

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


大功告成!!!

相关推荐

office2010三合一精简版(office2010三合一精简版32位)

你好,这个问题有点外行了,office2010作为微软公司的办公套件,一般包括常用的word、excel、powerpoint等模块。另外,不常用的MicrosoftAccess2010(数据库管...

window7旗舰版忘记登录密码怎么办

1、首先重启系统,屏幕亮之后按下键盘上F8键,鼠标选中“带命令提示符的安全模式”,键盘上按下回车(Enter)键;2、之后电脑屏幕出现两个用户名,鼠标点击“administrator”用户名;3、在安...

360手机桌面主题下载(360手机主题在哪个文件夹)

要在360手机助手上换主题,首先需要打开应用,然后在主界面上找到“主题”选项,点击进入。在主题页面上,可以浏览不同的主题,选择自己喜欢的主题后,点击“下载”按钮进行下载。下载完成后,点击“使用”按钮即...

惠普1020win11驱动(惠普1020 驱动)

1在浏览器中搜索hp1020打印机。2选择官方网站点击进入。3选择【软件与驱动程序】选项。4选择【打印机】选项。5输入打印机型号【1020】并点击【提交】。6选择打印机驱动并点击打印机型号。7进入下载...

卓越电脑定时关机软件(定时关机的电脑软件)

要关闭速腾卓越自动启停功能,首先启动车辆,然后找到车辆控制面板上的“车辆”按钮,点击进入车辆设置界面,再选择“驾驶辅助”功能,在其中找到“自动启停”选项,然后点击关闭即可。另外,也可以通过长按“ESP...

app免费下载大全(百度应用宝免费官方下载)

下载无忧(www.xiazai51.com)是一个绿色、安全、免费的下载网站,为给大家提供优质的下载服务,本网站程序由专业团队自主研发,不采用第三方模板,网站程序拥有自主知识产权。网站提供提供电脑软件...

电脑上有声音显示但没声音(电脑有声音没图像是什么原因)
电脑上有声音显示但没声音(电脑有声音没图像是什么原因)

1、主机的显卡出问题了。看下显卡有没有坏,还有看下主机有没有报警的声音。如果你使用的是独立显卡的话,那就拔掉它,插在集成显卡上面,来查看集成显卡有没有信号。解决方法:内存问题首先检查下内存有没有插紧,一般在机箱搬动过后有可能内存变松动造成开...

2026-01-08 20:03 off999

官方网站app下载安装免费(官方app软件下载)

不是太靠谱,很小的电影平台,很多电影,电视资源不全。有的完全看不了,根本不能下载。越用越不好用,不敢充值会员,怕有一天平台会倒掉。根本无法获取视频的地址,在使用体验上,没有爱奇艺,优酷,腾讯视频那么清...

c盘不能格式化为什么(c盘不能格式化为什么呢)

电脑中c盘不能格式化的,可以通过会出出厂设置的办法还原c盘,步骤如下。1,打开windows10系统,在开始中点击“设置”。2,在设置中点击“更新与安全”。3,在窗口中点击“恢复”选项。4,在界面内点...

重装机兵4下载手机版(重装机兵4下载手机版中文)

重装机兵4下载码是一种数字代码,可以用于在指定平台上下载游戏。玩家可以通过购买或获得下载码来获取游戏,然后在指定平台上输入下载码即可开始下载游戏。重装机兵4是一款机甲题材的游戏,玩家可以在游戏中扮演机...

联想光驱怎么重装系统步骤(联想驱动光盘怎么重装系统)

根据型号的不同按键也不同,在开机界面都会有提示,通常是F12键,按下之后就可以选择使用光驱启动,再按以下步骤安装即可。;工具:电脑、安装盘。;1、将系统盘放入光驱内,启动电脑后按F12键后显示如下界面...

一键qq盗号器免费(一键qq盗号器可信吗)

当然有,不仅仅是盗QQ号,还会盗银行账号,游戏账号等等。恩那。根本不用手机,直接电脑都可以改密码了!诅咒那些盗号的人!你设了密保根本没有用!1.盗号网站可以上12321进行举报,反馈问题比较快而且正...

win7摄像头万能驱动(win7摄像头驱动下载安装)

右键点击我的电脑,打开设备管理器,找到图像处理设备,在打开摄像头视频处理设备,右键属性,在设备使用状态栏,选择使用这个设备(启用),点击确定,重启电脑,就ok了。  电脑设置启用摄像头 1、在计算机上...

电脑怎么恢复win7系统(win7电脑如何恢复)

使用大白菜超级u盘还原window系统大白菜超级u盘启动制作工具是一款可以真正的快速一键制作万能启动U盘,所有操作只需要点一下鼠标,操作极其方便简单。下面向大家介绍大白菜如何装系统。方法/步骤1.下载...

用户名是什么意思怎么填写(企业用户名是什么意思怎么填写)

用户名(英文名:Username),是网络术语之一。就是要登录(登入、登录、进入等)的帐户名,即在所在网站的识别码。可以使用汉字、字母、字码等,如珠穆朗玛峰,zmlmf,12345,等,都作为用户...

取消回复欢迎 发表评论: