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

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

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


大功告成!!!

相关推荐

下书网电子书下载网站(下书网免费下载小说)

存放在我的书架里,可以查看

cad怎么下载(cad怎么下载到电脑上)

1、在搜索引擎中输入cad安装包并点击搜索,选择一款安装包进行下载。2、将下载的cad安装包解压出来,右键点击解压文件,在解压出来的文件里面找到setup安装程序,双击开始安装。3、点击开始安装,勾选...

ps教程免费视频教程全集(ps教程视频全集观看)

Photoshop自带的教程关了以后怎么找到首先我们打开Photoshop,在最上面的工具栏中找到窗口。点击窗口,在下面找到“学习”工具。然后点击,教程就会出现啦。Photoshop自带的教程关了以后...

抖抈短视频app下载安装(抖抈短视频app下载大全)

抖拍抖拍app56个民族服饰换装特效视频拍摄是最近非常火爆的民族服饰换装拍摄视频的特效素材,涵盖了非常多好玩的特效素材可以免费进行拍摄使用,在线一键换装56个民族的服饰拍摄,感受各地的异域风情,看看自...

qq电脑版免费下载(qq 电脑版官方下载免费下载)

下载QQ的方法如下:1)登录QQ手机版官网http://im.qq.com/mobileqq选择你的手机机型或手机操作平台进行下载。2)通过AppStore(苹果商城)、手机应用商店搜索“QQ...

驾考宝典下载安装(河南驾考宝典下载安装)

1、可以在电脑上下载传到手机上。2、可以直接在手机上下载,安卓市场里就有。驾考宝典电脑版激活方法如下:首先,打开驾考宝典电脑版软件,点击右上角的“激活”按钮,然后输入购买时所提供的激活码,点击“确定...

天气预报30天查询(天气预报30天查询温州市)

一月份天气预报查询是可以查询30天的天气预报。现在的天气预报都比较准,能查询当天的,也能查询一星期半个月的,查询30天的也可以,只是天数越多误差也就越大了,一般都会查询几天的天气预报和十五天的天气情况...

姓名打分免费查询(姓名打分免费查询周易官网)

妈妈好孕网的姓名打分测试是一种基于姓名学理论的个性特征及吉凶预测方法,通过对汉字笔画、五行属性等进行分析,来评估姓名所包含的信息和作用。但是,这种测试并没有科学依据,也无法完全准确地反映出一个人的性格...

游戏下载软件(十大手游平台app)

App里面下载游戏,我们只能在手机app里面就能下载,以下就是下载的方法首先我们打开手机,在手机页面中,我们找到下载游戏的app的图标,然后我们点击打开App进入页面,我们点击搜索框搜索游戏,...

slidesgo免费ppt模板(slide做ppt)

slides释义:v.滑;下跌(slide的三单形式);徐徐而行n.[电影]幻灯片(slide的复数);滑动例句:Hislecturewasillustratedwithslides...

下载斗地主真人欢乐斗地主(下载真人玩欢乐斗地主)

是的,是真人。也有机器人的。淘宝上面斗地主都是真人。因为淘宝上面斗地主是属于淘宝开发的网络游戏。在淘宝上面进行斗地主的都是实名注册的玩家双喜斗地主中的玩家既有真人也可能包含一些电脑AI玩家。在大多...

wifi管家防蹭网手机版(wifi管理器防蹭网手机版)

1.首先我们打开手机进入到桌面然后连接我们的wifi。2.接下来我们打开桌面的设置图标,进入到设置界面之后,点击wlan选项。3.然后我们点击已经连接的wifi选项。4.接下来我们就会进入到网络...

vmware虚拟机手机版(vmware虚拟机手机版电脑系统)

V7.1.4是最新的当然也是最好的,但是注册码难找所以V7.1.3才是最适合你的当然最好是原版+汉化包咯精简版或者绿色版会出现很多问题的我记得默认是开启的,可以点击设置,进入后,打开wlan就可...

华泰证券下载手机版(华泰证券交易手机版下载)

华泰证券卸载并不是删除华泰证券账户信息,再次下载后,登录用户名后,里面的记录还有

植物大战僵尸2中文版下载(植物大战僵尸2中文版下载苹果)

那只有国际版了。中文是专门坑钱,把原本免费的植物都搞成了攒碎片。僵尸还会升阶。国际版不仅关卡全,还在不断增加拓展关,但是有些植物需内购。中文的所有植物都是能免费得到,但需要攒碎片。总的来说,破解版的植...

取消回复欢迎 发表评论: