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

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

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


大功告成!!!

相关推荐

下载钉钉软件(下载钉钉软件有什么风险)

应用商店下载正版的。可以通过应用商城下载,这里面下载是自动安装的,也可以下载一个浏览器,然后在浏览器中输入钉钉,并点击搜索找到官方网站进行合适的资源下载步步高家教机可以下载安装钉钉下载钉钉要用手机号码...

windows10序列号查看(win10怎样查看序列号)

Win10快速查看序列号的方法:  1、使用电脑快捷键组合“WIN+R”,打开运行窗口。? 2、输入“regedit”,打开注册表编辑器。?  3、打开注册表,路径HKEY_LOCAL_MA...

怎么安装以前的显卡驱动(如何安装以前的显卡驱动)

首先需要找到显卡的型号,搜索该显卡的驱动历史版本,其次根据所需要的版本下载驱动程序并安装,安装后进入设备管理器查看驱动安装是否成功以及运行状态即可。在设备管理器找到显示适配器,右键选择属性;在驱动程序...

电脑在运行但是屏幕是黑的(电脑正常运行,显示屏黑屏怎么办)
电脑在运行但是屏幕是黑的(电脑正常运行,显示屏黑屏怎么办)

主机运行正常,而显示器黑屏,这很可能是三个原因:第一原因:就是显示器的电源插头脱落,没有电源输入,所以无法启动显示器,因些黑屏,建义重新拨插一下显示器的电源插头。第二个原因:有可能台式主机和显示器的连接视频线接触不良(特别是接口处没有插好或...

2026-01-07 08:51 off999

联想笔记本触摸板驱动下载官网

首先你要确保自己的电脑具备触屏的功能才可以使用,不然是没法使用的。如果是失效的话那就要改善使用系统,首先需要干净启动。然后需要关闭或者开启你电脑的“快速启动”。将系统停止或者开启“windowsfo...

win10开机有画面进系统黑屏(windows10一开机就黑屏)

步骤如下:1出现黑屏情况要区分,初次安装系统,或更新系统之后,会不能立马进入系统,属正常现象,等一段时间就好了。这里主要说的登录屏幕黑屏之后,其他应用程序都能使用的情况。2只有符合上述情况,可按Ctr...

笔记本买酷睿的还是锐龙(笔记本cpu锐龙的好还是酷睿的好)

锐龙本的第一个优点是价格便宜,而且便宜力度是会让人心动的那种,在后面推荐的锐龙本中你就能感受到;第二个优点是R5-2500U内置的Vega8显卡要比UHD630强,虽然与独显MX150有差距,但比没...

怎么看笔记本配置好不好(怎样看笔记本的配置好坏)
  • 怎么看笔记本配置好不好(怎样看笔记本的配置好坏)
  • 怎么看笔记本配置好不好(怎样看笔记本的配置好坏)
  • 怎么看笔记本配置好不好(怎样看笔记本的配置好坏)
  • 怎么看笔记本配置好不好(怎样看笔记本的配置好坏)
windows10重置密码(windows10重置密码向导怎么弄)

要使用Windows10重置密码向导来更改登录密码,首先需要在登录页面选择“忘记密码”选项。接着会出现向导页面,需要输入该用户的Microsoft账户用户名和相关信息以进行验证。然后可选择通过手机或电...

acer台式电脑(acer台式电脑主机开机步骤)

acer是宏碁旗下的一款电脑产品。宏碁成立于1976年,是一个国际化的自有品牌公司,主要从事于智能手机、平板电脑、个人电脑、显示产品与服务器的研发、设计、行销、销售及服务,也结合物联网积极发展云端技术...

电脑怎么添加字体(电脑怎么添加字体到ps)

要在电脑上增加字体,可以按照以下步骤进行操作:1.在互联网上找到并下载所需的字体文件。通常字体文件的格式为.ttf(TrueType字体)或.otf(开放字体)。2.打开下载完成的字体文件,然后点...

win7杀毒软件排行(win7最适合的杀毒软件)

360杀毒软件和安全卫士Windows7有自带的杀毒软件,叫做WindowsDefender。WindowsDefender是Microsoft开发的、提供给Windows7以上版本的Wi...

戴尔2025新款笔记本(戴尔2025年新款笔记本)

灵越16plus 定位是全能本,拥有游戏本的性能,外观重量接近轻薄本,散热好,满足主流设计软件使用,玩中小型游戏无压力,还有硬件防蓝光屏幕保护眼睛~成就5320性能颜值在线,日常办公使用...

iso9001最新版本(iso9001最新版本内容)

有,是ISO9001:2015。ISO9001是国际标准化组织的标准代号,自1988年起这个标准号就没变过,始终是通用质量管理体系的认证标准,没有新旧之说。此标准目前最新版本是2015年发布,所以现...

最好的显卡品牌(最好的显卡排名)

显卡中的NVIDIA显卡,索泰,迅景,影驰,华硕,微星都是最好的。ATI显卡中的老大是蓝宝石,其次是迪兰恒进,不过迪兰恒进显卡不是本厂生产,是由蓝宝石代工的。如果楼主喜欢玩游戏,我个人推荐AMD系列配...

取消回复欢迎 发表评论: