Requirements

apt-get install build-essential devscripts

Get source

apt-get source nginx
cd nginx-*
cd debian/modules
wget -O ngx_pagespeed.tar.gz https://github.com/pagespeed/ngx_pagespeed/archive/master.tar.gz
tar -xzf ngx_pagespeed.tar.gz
rm *.tar.gz
cd ..

Add module

Edit debian/rules, add --add-module=$(MODULESDIR)/ngx_pagespeed to your favorite flavour of nginx (-light, -full, -extra). (See the file contents, you’ll figure the correct place. Note: you MUST use tabs for the indentation.)

$EDITOR rules
cd ..

Misc

Update changelog & version (“oh hai, I has custom version with ngx_pagespeed”).

dch
dch --release

(dch comes from package devscripts)

Build

debuild-pbuilder -us -uc

After completion, you should find your .deb from parent directory.

Feedback / comments?

Ping me (@ypcs) on Twitter