查看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/zh-tw/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

發表回復

登錄後才能評論