查看nginx安装了哪些模块

一、查看nginx安装过的模块

如果我们已经安装了nginx,那么我们可以通过以下命令来查看nginx的编译参数,从而知道nginx安装了哪些模块:

nginx -V

执行该命令后,就会显示nginx的编译参数信息,其中会包含许多模块:

nginx version: nginx/1.14.2
built by gcc 4.8.5 20150623 (Red Hat 4.8.5-36) (GCC)
built with OpenSSL 1.0.2k-fips  26 Jan 2017
TLS SNI support enabled
configure arguments: --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-file-aio --with-ipv6 --with-http_ssl_module --with-http_v2_module --with-http_realip_module --with-stream_ssl_module --with-stream=dynamic --with-stream_ssl_preread_module --with-pcre --with-pcre-jit --with-openssl=/builddir/build/BUILD/nginx-1.14.2/openssl-1.0.2k --add-module=/builddir/build/BUILD/nginx-1.14.2/njs/nginx --with-http_stub_status_module --with-http_gzip_static_module --with-http_auth_request_module --with-http_addition_module --with-http_geoip_module=dynamic --with-http_image_filter_module=dynamic --with-http_sub_module --with-http_dav_module --with-http_flv_module --with-http_mp4_module --with-http_random_index_module --with-http_secure_link_module --with-http_degradation_module --with-http_slice_module --with-http_ssl_module --with-mail=dynamic --with-mail_ssl_module --with-pcre --with-pcre-jit --add-dynamic-module=/builddir/build/BUILD/nginx-1.14.2/modules/nginx-upstream-hash --add-dynamic-module=/builddir/build/BUILD/nginx-1.14.2/modules/nginx-fancyindex --add-dynamic-module=/builddir/build/BUILD/nginx-1.14.2/modules/nginx-auth-ldap --add-dynamic-module=/builddir/build/BUILD/nginx-1.14.2/modules/ngx_cache_purge --add-dynamic-module=/usr/local/src/incubator-pagespeed-ngx-1.13.35.2-stable

二、查看nginx安装的模块

如果我们需要查看nginx确切已安装的模块,可以通过以下命令查询:

nginx -V 2>&1 | grep modules

执行该命令后,就会显示nginx已安装的模块:

--modules-path=/usr/lib64/nginx/modules --with-stream=dynamic --with-stream_ssl_module --with-stream_ssl_preread_module --with-openssl=/builddir/build/BUILD/nginx-1.14.2/openssl-1.0.2k --add-module=/builddir/build/BUILD/nginx-1.14.2/njs/nginx --with-http_stub_status_module --with-http_gzip_static_module --with-http_auth_request_module --with-http_addition_module --with-http_geoip_module=dynamic --with-http_image_filter_module=dynamic --with-http_sub_module --with-http_dav_module --with-http_flv_module --with-http_mp4_module --with-http_random_index_module --with-http_secure_link_module --with-http_degradation_module --with-http_slice_module --with-http_ssl_module --with-mail=dynamic --with-mail_ssl_module --add-dynamic-module=/builddir/build/BUILD/nginx-1.14.2/modules/nginx-upstream-hash --add-dynamic-module=/builddir/build/BUILD/nginx-1.14.2/modules/nginx-fancyindex --add-dynamic-module=/builddir/build/BUILD/nginx-1.14.2/modules/nginx-auth-ldap --add-dynamic-module=/builddir/build/BUILD/nginx-1.14.2/modules/ngx_cache_purge --add-dynamic-module=/usr/local/src/incubator-pagespeed-ngx-1.13.35.2-stable

三、查看nginx已安装模块

如果我们需要快速查看nginx已安装的模块,可以使用以下命令直接列出nginx已安装的模块:

ls /usr/lib64/nginx/modules/

执行该命令后,就会列出已经安装好的nginx模块:

ngx_http_geoip_module.so  ngx_stream_upstream_module.so  ngx_stream_ssl_preread_module.so  ngx_stream_ssl_module.so  ngx_stream_realip_module.so  ngx_stream_dubbo_module.so  ngx_stream_core_module.so  ngx_http_xslt_filter_module.so  ngx_http_v2_module.so  ngx_http_upstream_module.so  ngx_http_sub_module.so  ngx_http_slice_module.so  ngx_http_set_misc_module.so  ngx_http_secure_link_module.so  ngx_http_realip_module.so  ngx_http_proxy_module.so  ngx_http_perl_module.so  ngx_http_mp4_module.so  ngx_http_js_module.so  ngx_http_image_filter_module.so  ngx_http_geoip2_module.so  ngx_http_gzip_static_module.so  ngx_http_fancyindex_module.so  ngx_http_dav_module.so  ngx_http_degradation_module.so  ngx_http_addition_module.so  ngx_http_auth_request_module.so

四、nginx有哪些模块

nginx官方提供了许多模块,可以通过源码安装,安装过程中可以选择需要的模块。这些模块包括:

  • HTTP模块
    • ngx_http_realip_module
    • ngx_http_addition_module
    • ngx_http_xslt_module
    • ngx_http_image_filter_module
    • ngx_http_geoip_module
    • ngx_http_sub_module
    • ngx_http_dav_module
    • ngx_http_flv_module
    • ngx_http_mp4_module
    • ngx_http_random_index_module
    • ngx_http_secure_link_module
    • ngx_http_degradation_module
    • ngx_http_slice_module
    • ngx_http_stub_status_module
    • ngx_http_ssl_module
    • ngx_http_v2_module
    • ngx_http_gzip_static_module
    • ngx_http_auth_request_module
    • ngx_http_perl_module(第三方模块)
    • ngx_http_js_module(第三方模块)

  • Mail模块
    • ngx_mail_ssl_module

  • Stream模块
    • ngx_stream_ssl_module
    • ngx_stream_realip_module
    • ngx_stream_geoip_module
    • ngx_stream_ssl_preread_module
    • ngx_stream_limit_conn_module
    • ngx_stream_limit_req_module

五、nginx查看已安装模块

如果我们在安装时选择了某个模块,但不确定是否已经成功安装可以通过以下命令来查看:

nginx -V 2>&1 | grep module_name

其中“module_name”指的是模块的名称。如果输出结果中包含该模块的信息,则说明该模块已经被成功安装。

六、nginx安装ssl模块

ssl模块是用于支持https协议的模块。nginx中默认开启了ssl模块,如果在编译安装nginx时没有开启ssl模块,那么需要重新编译nginx,并在编译选项中添加“–with-http_ssl_module”参数。具体安装步骤如下:

  1. 下载nginx源码(https://nginx.org/en/download.html),解压后进入nginx源码目录。
  2. 执行以下命令,安装编译依赖及PCRE和OpenSSL:
  3. yum install gcc gcc-c++ make zlib-devel pcre pcre-devel openssl openssl-devel
  4. 执行以下命令执行编译及安装:
  5. ./configure --prefix=/usr/local/nginx --with-http_ssl_module
    make && make install
  6. 安装完成后,执行以下命令启动nginx:
  7. /usr/local/nginx/sbin/nginx

七、nginx安装lua模块

lua模块是用于支持Lua脚本的模块。在编译安装nginx时需要添加“–with-http_lua_module”参数。具体安装步骤如下:

  1. 下载nginx源码(https://nginx.org/en/download.html),解压后进入nginx源码目录。
  2. 安装luajit:
  3.  yum install -y git gcc make readline-devel ncurses-devel
     git clone https://github.com/openresty/luajit2.git
     cd luajit2
     make && make install
  4. 执行以下命令安装编译依赖:
  5. yum install -y gcc gcc-c++ autoconf automake make zlib zlib-devel openssl openssl-devel pcre
  6. 执行以下命令以编译nginx:
  7. ./configure --prefix=/usr/local/nginx --with-http_ssl_module --add-module=/path/to/lua-nginx-module
  8. 可以通过以下命令测试Lua是否工作正常:
  9. curl http://localhost/test.lua

八、nginx支持哪些常用模块

nginx默认支持的常用模块:

  • HTTP模块:
    • ngx_http_realip_module:实现客户端IP地址的获取和替换
    • ngx_http_addition_module:支持在文件中添加自定义头和尾
    • ngx_http_xslt_module:支持对后端返回的XML格式内容进行XSLT操作
    • ngx_http_image_filter_module:支持在nginx内置生成缩略图
    • ngx_http_geoip_module:获取客户端地理位置
    • ngx_http_google_filter_module:支持将谷歌搜索结果内嵌至页面
    • ngx_http_sub_module:实现内容替换功能
    • ngx_http_dav_module:配置WebDAV
    • ngx_http_flv_module:支持Flv流输出
    • ngx_http_mp4_module:支持Mp4文件流输出
    • ngx_http_random_index_module:支持目录随机页面
    • ngx_http_secure_link_module:生成安全链接
    • ngx_http_slice_module:支持文件分块下载
    • ngx_http_degradation_module:实现页面降级
    • ngx_http_slice_module:支持文件分块下载
    • ngx_http_stub_status_module:提供nginx状态信息
    • ngx_http_ssl_module:支持SSL协议
    • ngx_http_v2_module:支持HTTP2协议
    • ngx_http_gzip_static_module:开启Gzip功能
    • ngx_http_auth_request_module:实现简单的认证功能
    • ngx_http_perl_module(第三方):集成Perl解释

      原创文章,作者:小蓝,如若转载,请注明出处:https://www.506064.com/n/279651.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
小蓝小蓝
上一篇 2024-12-20 15:04
下一篇 2024-12-20 15:04

相关推荐

  • 光模块异常,SFP未认证(entityphysicalindex=6743835)——解决方案和

    如果您遇到类似optical module exception, sfp is not certified. (entityphysicalindex=6743835)的问题,那么…

    编程 2025-04-29
  • Python模块下载与安装指南

    如果想要扩展Python的功能,可以使用Python模块来实现。但是,在使用之前,需要先下载并安装对应的模块。本文将从以下多个方面对Python模块下载与安装进行详细的阐述,包括使…

    编程 2025-04-29
  • Python编程三剑客——模块、包、库

    本文主要介绍Python编程三剑客:模块、包、库的概念、特点、用法,以及在实际编程中的实际应用,旨在帮助读者更好地理解和应用Python编程。 一、模块 1、概念:Python模块…

    编程 2025-04-29
  • Python如何下载第三方模块

    想要使Python更加强大且具备跨平台性,我们可以下载许多第三方模块。下面将从几个方面详细介绍如何下载第三方模块。 一、使用pip下载第三方模块 pip是Python的软件包管理器…

    编程 2025-04-28
  • 如何使用pip安装模块

    pip作为Python默认的包管理系统,是安装和管理Python包的一种方式,它可以轻松快捷地安装、卸载和管理Python的扩展库、模块等。下面从几个方面详细介绍pip的使用方法。…

    编程 2025-04-28
  • Python datetime和time模块用法介绍

    本文将详细阐述Python datetime和time模块的用法和应用场景,以帮助读者更好地理解和运用这两个模块。 一、datetime模块 datetime模块提供了处理日期和时…

    编程 2025-04-28
  • Idea创建模块时下面没有启动类的解决方法

    本文将从以下几个方面对Idea创建模块时下面没有启动类进行详细阐述: 一、创建SpringBoot项目时没有启动类的解决方法 在使用Idea创建SpringBoot项目时,有可能会…

    编程 2025-04-28
  • l9110风扇传感器模块原理图解析

    本文将从原理图概述、硬件特性、软件实现等多个方面对l9110风扇传感器模块进行详细解析,并给出对应代码实例。 一、原理图概述 l9110风扇传感器模块主要由驱动芯片l9110、电位…

    编程 2025-04-28
  • 掌握Python3中datetime模块的使用

    Python3中的datetime模块是处理日期和时间的常用模块之一,它提供了一些函数和类,可以轻松处理日期和时间,包括日期和时间的计算、格式化、解析、时区转换等。本文将从多个方面…

    编程 2025-04-28
  • Python导入模块方法

    在Python编程中,模块是管理函数和变量之类内容的一种方式。Python标准库提供了许多有用的模块,让我们可以方便地实现对底层硬件和网络等的控制。本文将介绍Python中常用的导…

    编程 2025-04-28

发表回复

登录后才能评论