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

yum安装nignx 添加模块(yum安装nmap)

nanshan 2025-03-29 20:06 6 浏览 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


大功告成!!!

相关推荐

ssh终端xshell日志查看命令(xshell怎么看日志)

现在我们云服务器运维较多用的是SSH工具,其中常用的包括PUTTY、XSHELL等,其实大同小异界面UI稍微不同,但是都可以进入远程连接。这里有朋友提到如何查看服务器的日志文件,这个其实和是否使用XS...

使用 Fail Ban 日志分析 SSH 攻击行为

通过分析`fail2ban`日志可以识别和应对SSH暴力破解等攻击行为。以下是详细的操作流程和关键分析方法:---###**一、Fail2ban日志位置**Fail2ban的日志路径因系统配置...

如何高效读取Linux日志文件?这些命令要熟记于心!

在Linux系统中,日志文件通常存储在/var/log目录下。比如,/var/log/syslog(或/var/log/messages,视发行版而定)记录系统整体事件,/var/log/a...

Windows服务器远程登录日志查询方法,linux查看登录日志方法

概述本文介绍Windows、Linux服务器查询系统的远程登录日志方法。根据服务器所使用的操作系统不同,有以下两种查询方法。Linux操作系统的登录日志查询通过远程连接登录Linux服务器,使用roo...

iptables防火墙如何记录日志(防火墙日志查看)

例如:记录所有ssh服务的登录的日志首先,我们需要了解如何将所有的iptables的INPUT链数据包记录到/var/log/messages中。如果你已经有一些iptables规则了,那么将记录日志...

如何安全管理SSH密钥以防止服务器被入侵

SSH密钥安全管理实施指南(2025年更新版)一、密钥生成与存储规范高强度密钥生成bashCopyCodessh-keygen-ted25519-a100#生成ED25519算法密钥(比...

在CentOS上安装nginx服务器(centos搭建代理服务器)

一、环境描述1.虚拟机配置CPU:单核内存:2GB硬盘:120GBIP:10.24.17.1082.操作系统版本:CentOS6.6x86_64安装方式:Minimal3.虚拟化环境VM...

CentOS7安全加固的一份整理规划建议

◆更新系统:及时更新CentOS7操作系统版本和安全补丁,确保系统以最新状态运行。◆关闭不必要的服务:在运行系统时,应关闭不需要的服务和端口,以减少系统暴露的攻击面。◆安装防火墙:使用iptables...

第四十七天-二叉树,centOS安装tomcat,Maven,vsftpd

学习笔记:1.Maven是Apache下的一个纯Java开发的开源项目。基于项目对象模型(缩写:POM)概念,Maven利用一个中央信息片断能管理一个项目的构建、报告和文档等步骤。Maven...

Linux远程桌面连接使用教程 Widows终端远程连接Linux服务器

一、前言为什么不是远程连接Linux服务器?因为我不会,远程连接window我就用电脑自带的“远程桌面连接”。以下所述都是在CentOS操作系统下的。服务器刚换成Linux的时候很迷茫,感觉无从下手...

CentOS 安全加固操作,保护你的操作系统

系统加固是保障系统安全的重要手段,对于维护企业数据安全、用户隐私以及系统稳定运行具有重要意义。加固后的系统更加健壮和稳定,能够有效减少因安全问题导致的系统故障和停机时间,提高系统的可用性和可靠性。通过...

Dockerfile部署Java项目(docker如何部署java项目)

1、概述本文主要会简单介绍什么是Docker,什么是Dockerfile,如何安装Docker,Dockerfile如何编写,如何通过Dockerfile安装jar包并外置yaml文件以及如何通过do...

CentOS7云主机部署Fail2ban阻断SSH暴力破解

关于Fail2banFail2ban可以监视你的系统日志,然后匹配日志的错误信息(正则式匹配)执行相应的屏蔽动作(一般情况下是调用防火墙屏蔽)例如:当有人在试探你的HTTP、SSH、SMTP、FTP密...

在CentOS7上用源码编译安装PostgreSQL

1、新建postgres用户#useraddpostgres&&passwdpostgres2、安装依赖包#yum-yinstallmakegccgcc-c++readline...

pure-ftpd 使用(ftp prompt命令)

pure-ftpd是一个免费的ftp软件,其他介绍就不多说了。我们直接开始主题安装centosyuminstallepel-releaseyuminstallpure-ftpd配置备份原配置...

取消回复欢迎 发表评论: