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

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

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


大功告成!!!

相关推荐

照片恢复(照片恢复免费版下载)

方法/步骤  1.首先下载一个数据恢复软件。  2.安装到电脑上,然后把手机和电脑连接起来。  3.接着我们用下载好的数据恢复软件扫描手机。  4.然后找出要恢复的文件照片。  5.在电脑上选在一个磁...

tiktok官方网站入口(tiktok官方网站入口免费)

入口就是TikTok商店卖家。具体步骤如下:为了加入TikTok商店,您首先需要一个TikTok帐户。一旦您拥有TikTok帐户并且超过了符合条件的年龄,就可以使用它注册为TikTok商店卖家。卖家...

adobe flash player播放器(adobe flash player viewer)

不同操作系统不同浏览器,开启Adobeflashplayer的方法各有不同。开启的前提当然是正确安装喽,不同操作系统不同浏览器安装Adobeflashplayer方法也是各不相同的。Wind...

央视cctv5体育直播(央视cctv5体育直播在线观看免费)

现在全国每家都有机顶盒,在机顶盒上就可以看CCTV所有频道。也可以用手机浏览器搜索CCTV5体育频道。还有就是可以手机上下载安装央视影音APP,央视频APP都可以看。中央电视台体育频道(频道呼号:CC...

激活工具永久激活win7(win7激活工具2021)
  • 激活工具永久激活win7(win7激活工具2021)
  • 激活工具永久激活win7(win7激活工具2021)
  • 激活工具永久激活win7(win7激活工具2021)
  • 激活工具永久激活win7(win7激活工具2021)
直播平台app下载大全(直播平台app下载大全免费)
直播平台app下载大全(直播平台app下载大全免费)

专门观看淘宝直播的APP是点淘,这款APP是这段时间才出的,我下载了一个,但是我下载这款APP不是为了买东西当时也是看广告连接才点进去的,它这上面是可以赚一些零花钱,我下载之后他给了我七块钱,然后现在每天弄不弄也能弄个一块钱左右。但是里边的...

2026-01-19 01:15 off999

网络播放器app(网络播放器怎么连接电视机)

牛片APP一站式影视智能功能,几乎可以满足影视人工作中的所有需求。包含的功能有:文字转语音、真人配音、自动加字幕、一键去水印、提词器、拍片估价、堪景神器、影视课程、发布影视相关需求、接单赚钱....等...

audition(audition属于什么软件)

Audition是一款由Adobe开发的音频编辑和混音软件,具有以下主要功能:1.音频录制和编辑:可以录制不同类型的音频,包括对话、音乐、戏剧和环境声音等,还可以使用多种音频效果处理工具对录制...

office2020官方下载免费完整版

Microsoft365和Office2020的区别有以下几点:功能不同。Office2020包含Word、Excel、PowerPoint等组件,功能比较全面;而Microsoft365包...

微信管理软件(微信管理)

微信管理,可以一键将消息发送到多个群,不限制群数量和次数选择好群组发送消息即可。“里德助手”多消息群发,可以设置多条消息发送,包括图文、小程序,公众号,文章等都是可以的。亲密群发,逢年过节,总是要给...

优酷视频下载安装2025最新版本
优酷视频下载安装2025最新版本

2022爱奇艺腾讯优酷会员,要根据具体的需求来选择。喜欢青春偶像剧类型的可以选择爱奇艺视频;喜欢一些自制综艺和自制剧的优酷视频会员是不错的选择;腾讯视频定位就是主打大IP剧和一些热门综艺的转播,一般卫视播出的都会出现在腾讯视频有这方面需...

2026-01-19 00:03 off999

火辣辣的小说网(火辣辣的小说网名)

《司夜爵姜笙》。内容简介:今天是她的婚礼,可新郎司夜爵没有出现。姜笙站在台上,耳边充斥着满座亲朋的窃窃私语。想哭吗?想。可她要真哭出来,场面就更难看了。姜笙固执的站在那儿看着教堂大门。可看着天色从亮到...

小程序如何转换成word文档(小程序怎么转文档格式)

小程序文件一般是以小程序的代码形式存在的,不能直接转换成文档。如果需要将小程序中的文本内容转换为文档,可以尝试手动复制粘贴到文档编辑器中,或者使用相关的工具或软件进行批量转换。但是,需要注意版权问题和...

百度云网盘资源链接(百度云网盘资源链接群组小众圈子)

如果您想从网盘中提取网址,可以按照以下步骤操作:1.打开您的网盘,找到您想提取网址的文件或文件夹。2.右键单击该文件或文件夹,选择“复制链接”或“获取链接”等选项。3.将复制的链接粘贴到浏览器地...

pr软件下载手机版(pr软件官方下载)
pr软件下载手机版(pr软件官方下载)

pr2019的软件安装较为简单,点击setup.exe应用程序之后,在弹出的界面设置安装选项:1、语言2、安装路径。这里的语言默认选择中文。默认的安装路径在c盘,推荐安装的非系统盘的盘符中,比如D盘。单击文件后进行路径的指定,指定完成后默认...

2026-01-18 23:03 off999

取消回复欢迎 发表评论: