Building a nginx package with fair proxy module on Debian/Ubuntu
This’s how to recompile nginx with fair proxy module
We need to recompile nginx to support fair proxy module. Because debian based nginx, doesn’t have this module loaded. And we need to download the module from here
First of all, we need to install the software that’s needed to recompile a .deb packages
apt-get install build-essential debhelper fakeroot
Then go to /usr/src directory
cd /usr/src
Now we need to download the source package of nginx
apt-get source nginx
apt-get build-dep nginx
$ mkdir /path/to/ngx_http_upstream_fair_module
$ cd /path/to/ngx_http_upstream_fair_module
$ curl -o ngx_http_upstream_fair_module.cĀ http://github.com/gnosek/nginx-upstream-fair/tree/master%2Fngx_http_upstream_fair_module.c?raw=true
$ curl -o configĀ http://github.com/gnosek/nginx-upstream-fair/tree/master%2Fconfig?raw=true
Then we go to nginx directory
cd /usr/src/nginx-0.6.32/debian
Edit rules to add fair proxy module
vim rules
Add –add-module=/path/to/ngx_http_upstream_fair_module
Go back to nginx directory
cd ..
Now it’s time for us to compile nginx and take a glass of coffee while waiting
dpkg-buildpackage -rfakeroot
If you found error like
(WARNING: Failed to sign .dsc and .changes file)
That means normal. Just ignore the error msg
Now go back to /usr/src directory
cd /usr/src
You should see a file called nginx_0.6.32-3_i386.deb
Then install our new compiled nginx package
dpkg -i nginx_0.6.32-3_i386.deb
Then lastly we add “fair” module on our nginx.conf
Example
upstream backend {
server server1;
server server2;
fair;
}
Congratulations that you have install nginx with fair proxy module on your debian
1 Comment
Pingbacks