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

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

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


大功告成!!!

相关推荐

qq游戏大厅2025(QQ游戏大厅2025绿色版)

1.可以直接在漫展官方APP中进行购买门票。2.直接去漫展厅购买门票。3.有漫展代购者进行售卖门票,可以去进行购买。而这三种方式是购买漫展门票最快,最安全的购买方式。2023年cm漫展郑州市市区门票可...

看球直播app下载(看球帝app手机版免费下载)

电视直播ios版是一款连接了电视网为您提供电视直播信号的手机直播应用。无论是央视各台还是全国各大卫视都可以在这里免费收看,周五看浙江卫视《中国新歌声》,周六看湖南卫视《快乐大本营》,周末看东方卫视《极...

手机测wifi网速在线测试(我的网速测试)

在手机上进行Wi-Fi测速,您可以使用以下步骤: 1.打开手机的Wi-Fi功能,并连接到要测试的Wi-Fi网络。 2.打开手机浏览器,访问一个在线Wi-Fi测速网站,例如s...

腾讯对战平台官网(腾讯对战平台叫什么名字)

用管理员身份运行试试看,不如换个win7,下载一个小白,10分钟搞定。win7现在是市面上电脑最多的系统,兼容各种游戏辅助,各种游戏,各种办公软件,我自己就是win10,新电脑,我换了7,打开腾讯...

珍爱网(珍爱网免费征婚交友平台)

珍爱网上的人的确是真人,但那些人的资料况你很难判断它的真实性。如何你想在上面找到珍爱,那你得有优秀且真实的资本,要不然珍爱网就是珍爱网而已。灰姑娘很难遇上白马王子,除非你是漂亮的灰姑娘。癞蛤蟆也很难遇...

同城约会的app哪个免费(同城约会的app哪个免费好用)

玩这类app,最关键的不在软件本身,在于个人实力……能不能约到人?肯定有人成功过,我身边就有这样的例子,一哥们在一个叫么么哒的app上面就成功约到过几个妹子吃饭,代价是他在上面花了几万送女孩礼物淘她们...

1 42集免费观看(龙王传说第142集免费观看)

脊梁电视剧可以通过手机央视频APP看42集全,因为这部电视剧是在央视频网络平台上进行独播的去爱奇艺APP或者腾讯视频都可以看到读了《中国通史》,我深深感受到我美丽的祖国一中国历史的悠久文化的深远与美丽...

pp助手源最新地址(pp助手网址是多少)

1、打开Cydia。2、进入Cydia后,点击管理中的【软件源】。3、进入到【软件源】页面,点击【编辑】按钮。4、点击【添加】源按钮,跳出添加源弹窗。5、在弹窗中输入需要添加PP助手源地址http:/...

直接在手机上刷机软件(用手机给手机刷机的软件)

例如使用模拟器就可以第三方的刷机软件,或多或少都是带一点广告的!你要说完全好用的话,只能选奇兔了,奇兔它有专门的ROM移植团队。可以登录它的官网搜索每个品牌的手机的型号都有大神在里面,机型覆盖还是比较...

光影app下载(光影app下载正版官方)

回答如下:光影是一个Minecraft的模组,可以通过以下步骤下载:1.下载和安装Minecraft的启动器,确保已经安装了Minecraft。2.下载和安装Forge,它是运行Minecraft...

十大手游交易平台排行榜(手游交易平台2021前十名)

一、咪噜游戏盒子一款时下非常火爆的变态、破解、折扣游戏盒子,为玩家推送变态、无限元宝手游。至尊VIP、海量钻石元宝、独家礼包上线即送,开局你就是土豪。一款专门针对手机游戏爱好者设计推出的福利app平台...

qq游戏大全(QQ游戏大全列表 百度贴吧)

弟弟、牵姐的手一起走--姐姐、牵弟的手一起跑、小小理想--大大梦想、圆规画方--直尺画圆、萎靡开枝的茶--彼岸行走的花、指尖旳太阳--指尖旳月亮、弟、笑着转身--姐、哭着等待、甜甜的、棒棒糖--软软的...

笔记本电脑选哪个品牌比较好

1、苹果APPLE/美国2、戴尔DELL/美国3、华为HUAWEI/中国4、小米MI/中国5、微软Microsoft/美国6、联想LENOVO/中国7、惠普HP/美国8、华硕ASUS/...

10系列显卡排名(10系显卡性能排行)

十系显卡指NVIDIAGeForce10系列,是英伟达研发并推出的图形处理器系列,被用以取代NVIDIAGeForce900系列图形处理器。新系列采用帕斯卡微架构来代替之前的麦克斯韦微架构,并...

最新win7系统下载(windows7最新版本下载)
最新win7系统下载(windows7最新版本下载)

最简单的方法就是,下载完镜像文件后,直接把镜像文件解压,解压到非C盘,然后在解压文件里面找到setup.exe,点击运行即可。安装系统完成后,在C盘找到一个Windows.old(好几个GB,是旧系统打包在这里,垃圾文件了)删除即可。扩展资...

2026-01-15 06:43 off999

取消回复欢迎 发表评论: