Building a custom ( adding a custom plugin ) version of nginx in debian is not a very complicated job:
Create a directory ( ex test2 ) and change directory to it.
After that do:
apt-get source nginx
in debian directory you should modify rules file , then if necessary source/include-binaries , add your module in modules directory and modify README.Modules-versions to reflect your changes .
Change back to test2/nginx-1.4.1 directory and run
If everything works ok and module is configured correctly you should have it ready to be run:
dpkg -i nginx-full_1.4.1-3ubuntu1.3_amd64.deb nginx-common_1.4.1-3ubuntu1.3_all.deb