Skip to content
Timofey Kirillov edited this page Feb 28, 2018 · 1 revision

Welcome to the nginx-http-rdns wiki!

How to compile nginx-http-rdns with original nginx source code

Example, to compile nginx with nginx-http-rdns module using custom prefix dir (/usr/local by default).

  1. Being in nginx source code directory:
nginx-1.10.2$ ls 
auto  CHANGES  CHANGES.ru  conf  configure  contrib  html  LICENSE  Makefile  man  objs  README  src
  1. Put module into directory outside of that directory:
nginx-1.10.2$ ls ../nginx-http-rdns/ 
AUTHOR  config  LICENSE  ngx_http_rdns_module.c  README.md
  1. Run configure with --add-module option:
nginx-1.10.2$ ./configure --add-module=../nginx-http-rdns --prefix=./my-nginx
  1. Then make & make install:
nginx-1.10.2$ make && make install
...
nginx-1.10.2$ tree my-nginx/ 
my-nginx/ 
├── conf 
│   ├── fastcgi.conf 
│   ├── fastcgi.conf.default 
│   ├── fastcgi_params 
│   ├── fastcgi_params.default 
│   ├── koi-utf 
│   ├── koi-win 
│   ├── mime.types 
│   ├── mime.types.default 
│   ├── nginx.conf 
│   ├── nginx.conf.default 
│   ├── scgi_params 
│   ├── scgi_params.default 
│   ├── uwsgi_params 
│   ├── uwsgi_params.default 
│   └── win-utf 
├── html 
│   ├── 50x.html 
│   └── index.html 
├── logs 
└── sbin 
   └── nginx 

4 directories, 18 files 
nginx-1.10.2$ ./my-nginx/sbin/nginx -V 
nginx version: nginx/1.10.2 
built by gcc 5.4.0 20160609 (Ubuntu 5.4.0-6ubuntu1~16.04.5)  
configure arguments: --add-module=../../nginx-http-rdns --prefix=./my-nginx

As a result nginx is installed into ./my-nginx directory with compiled in nginx-http-rdns module.

How to build nginx debian package with nginx-http-rdns

  1. Download debian nginx source code and nginx-http-rdns module:
mkdir my-nginx-build && cd my-nginx-build
apt-get source nginx
cd nginx-1.10.3
git clone https://github.com/flant/nginx-http-rdns.git debian/modules/nginx-http-rdns
vim debian/rules
  1. Add line:
      --add-module=$(MODULESDIR)/nginx-http-rdns     

to light_configure_flags or full_configure_flags

For example to light flags:

nginx-1.10.3$ diff -Naurd debian/rules debian/rules.new 
--- debian/rules        2018-01-19 18:31:36.800719759 +0300 
+++ debian/rules.new    2018-01-19 18:31:29.824750304 +0300 
@@ -80,7 +80,8 @@ 
                       --without-http_ssi_module \ 
                       --without-http_userid_module \ 
                       --without-http_uwsgi_module \ 
-                       --add-module=$(MODULESDIR)/nginx-echo 
+                       --add-module=$(MODULESDIR)/nginx-echo \ 
+                       --add-module=$(MODULESDIR)/nginx-http-rdns 
 
full_configure_flags := \ 
                       $(common_configure_flags) \
  1. Then build debian packages:
nginx-1.10.3$ dpkg-buildpackage -b
...
nginx-1.10.3$ cd .. && ls
nginx-1.10.3                                 nginx-common_1.10.3-0ubuntu0.16.04.2_all.deb        nginx-full_1.10.3-0ubuntu0.16.04.2_amd64.deb 
nginx_1.10.3-0ubuntu0.16.04.2_all.deb        nginx-core_1.10.3-0ubuntu0.16.04.2_amd64.deb        nginx-full-dbg_1.10.3-0ubuntu0.16.04.2_amd64.deb 
nginx_1.10.3-0ubuntu0.16.04.2_amd64.changes  nginx-core-dbg_1.10.3-0ubuntu0.16.04.2_amd64.deb    nginx-light_1.10.3-0ubuntu0.16.04.2_amd64.deb 
nginx_1.10.3-0ubuntu0.16.04.2.debian.tar.xz  nginx-doc_1.10.3-0ubuntu0.16.04.2_all.deb           nginx-light-dbg_1.10.3-0ubuntu0.16.04.2_amd64.deb 
nginx_1.10.3-0ubuntu0.16.04.2.dsc            nginx-extras_1.10.3-0ubuntu0.16.04.2_amd64.deb 
nginx_1.10.3.orig.tar.gz                     nginx-extras-dbg_1.10.3-0ubuntu0.16.04.2_amd64.deb
  1. Now you can install nginx-light using dpkg:
$ sudo dpkg -i ./nginx-common_1.10.3-0ubuntu0.16.04.2_all.deb ./nginx-light_1.10.3-0ubuntu0.16.04.2_amd6
4.deb