1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

How to enable a dynamic module?

Discussion in 'Nginx' started by sbagmeijer, May 2, 2016.

Thread Status:
Not open for further replies.
  1. sbagmeijer

    sbagmeijer Machine

    First make sure you are using the Ulyaoth Nginx rpms they can be downloaded from:
    Stable: https://www.ulyaoth.net/resources/nginx-stable.24/
    Mainline: https://www.ulyaoth.net/resources/nginx-mainline.25/

    Once you have Nginx installed you are able to install one of the dynamic modules that we have:
    Code:
    ulyaoth-nginx-module-geoip
    ulyaoth-nginx-module-njs
    ulyaoth-nginx-module-perl
    ulyaoth-nginx-module-image-filter
    ulyaoth-nginx-module-xslt
    You can do this with the "yum" or "dnf" command for example if I want to install the GeoIP module I would do:
    Code:
    $sudo yum install ulyaoth-nginx-module-geoip
    
    Fedora 22+:
    $sudo yum install ulyaoth-nginx-module-geoip
    
    For Nginx mainline the package names would be "ulyaoth-nginx-mainline-modules-geoip" for example.

    If you watch correctly when you install one of the module you will see the following message during the installation:
    Code:
    The GeoIP dynamic module for nginx has been installed.
    
    To enable this module, add the following to /etc/nginx/nginx.conf
    and reload nginx:
    load_module modules/ngx_http_geoip_module.so;
    
    Please refer to the module documentation for further details:
    http://nginx.org/en/docs/http/ngx_http_geoip_module.html
    
    For any additional help please visit my forum at:
    * https://www.ulyaoth.net
    
    So let's do exactly what it does say there and first open our "nginx.conf" by doing the following command:
    Code:
    $sudo vi /etc/nginx/nginx.conf
    We already marked the location where you should put the line to load the module it is important you do it exactly on that location or you will see a error and nginx won't start.

    Code:
    # Load dynamic modules below this comment.
    So now lets add the line from when we installed the module rpm and it should look like this in your config:
    Code:
    # Load dynamic modules below this comment.
    load_module modules/ngx_http_geoip_module.so;
    
    That should be all just for the sake of it a full nginx.conf would look like this for example:
    Code:
    
    user  nginx;
    worker_processes  auto;
    
    error_log  /var/log/nginx/error.log warn;
    pid        /var/run/nginx.pid;
    
    # Load dynamic modules below this comment.
    load_module modules/ngx_http_geoip_module.so;
    
    events {
      worker_connections  1024;
      use epoll;
      multi_accept  on;
    }
    
    
    http {
      include       /etc/nginx/mime.types;
      default_type  application/octet-stream;
    
      log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '
                        '$status $body_bytes_sent "$http_referer" '
                        '"$http_user_agent" "$http_x_forwarded_for"';
    
      access_log  /var/log/nginx/access.log  main;
    
      server_tokens   off;
      sendfile        on;
      #tcp_nopush     on;
    
      keepalive_timeout  65;
    
      #gzip  on;
    
      include /etc/nginx/conf.d/*.conf;
      include /etc/nginx/sites-enabled/*.conf;
    }
    
    That is all now you reload nginx and your "GeoIP" module is running and can be used.

    We will do our best to add more modules over the next few weeks, if you would like to request for a module then please create a issue on our github at: https://github.com/ulyaoth/repository/issues
     
Thread Status:
Not open for further replies.

Share This Page