How to enable dynamic module with an existing NGINX installation

后端 未结 4 1286
轻奢々
轻奢々 2021-01-31 03:45

Introduction

From NGINX version 1.9.11 and upwarts, a new feature is introduced: dynamic modules.

With dynamic modules, you can optionally load separate shared

4条回答
  •  萌比男神i
    2021-01-31 04:11

    I had the same question, and @vladiastudillo answer was the missing piece I needed.

    First add the nginx stable repo:

    sudo add-apt-repository ppa:nginx/stable
    

    Then run apt update:

    sudo apt-get update
    

    And get the nginx geoip module:

    sudo apt-get install nginx-module-geoip
    

    This will download and load the module to /usr/lib/nginx/modules


    To load the nginx module,

    open nginx.conf:

    sudo nano /etc/nginx/nginx.conf
    

    add add below in the main context:

    load_module "modules/ngx_http_geoip_module.so";
    

    The module will be loaded, when you reload the configuration or restart nginx.

    To dynamically “unload” a module, comment out or remove its load_module directive and reload the nginx configuration.

提交回复
热议问题