Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
How to build nginx from sources on Ubuntu
export LANGUAGE="en_US.UTF-8" 
export LANG="en_US.UTF-8"
export LC_ALL="en_US.UTF-8"
locale-gen en_US.UTF-8 
dpkg-reconfigure locales

apt-get install unzip libpcre3 libpcre3-dev libssl-dev libpcrecpp0 zlib1g-dev debhelper dh-systemd libgeoip-dev autotools-dev libgd2-noxpm-dev libluajit-5.1-dev libmhash-dev libpam0g-dev libperl-dev po-debconf libexpat-dev libxslt1-dev

add-apt-repository ppa:nginx/development

#modify the nginx file in sources.list.d in order to allow for deb-src to be active
/etc/apt/sources.list.d/nginx-development-precise.list #Ubuntu 12.04
/etc/apt/sources.list.d/nginx-development-trusty.list #Ubuntu 14.04

apt-get update

mkdir -p /opt/nginx/sources
cd /opt/nginx/sources
apt-get source nginx=1.9.3

mkdir -p /opt/nginx/modules/
cd /opt/nginx/modules/

wget -O ngx_devel_kit-v0.2.19.tar.gz https://github.com/simpl/ngx_devel_kit/archive/v0.2.19.tar.gz
tar -zxf ngx_devel_kit-v0.2.19.tar.gz

wget -O set-misc-nginx-module-v0.29.tar.gz https://github.com/openresty/set-misc-nginx-module/archive/v0.29.tar.gz
tar -zxf set-misc-nginx-module-v0.29.tar.gz

wget -O srcache-nginx-module-v0.30.tar.gz https://github.com/openresty/srcache-nginx-module/archive/v0.30.tar.gz
tar -zxf srcache-nginx-module-v0.30.tar.gz

wget -O memc-nginx-module-v0.16.tar.gz https://github.com/openresty/memc-nginx-module/archive/v0.16.tar.gz
tar -zxf memc-nginx-module-v0.16.tar.gz

export LUAJIT_LIB=/usr/lib/x86_64-linux-gnu/
export LUAJIT_INC=/usr/include/luajit-2.0

cd /opt/nginx/sources/nginx-1.9.3/

vim debian/rules
## CHANGE full_configure_flags with this:
    $(common_configure_flags) \
    --with-http_addition_module \
    --with-http_dav_module \
    --with-http_geoip_module \
    --with-http_gunzip_module \
    --with-http_gzip_static_module \
    --with-http_image_filter_module \
    --with-http_secure_link_module \
    --with-http_spdy_module \
    --with-http_sub_module \
    --with-http_xslt_module \
    --with-http_ssl_module \
    --with-http_stub_status_module \
    --with-stream \
    --with-stream_ssl_module \
    --with-threads \
    --add-module=/opt/nginx/modules/ngx_devel_kit-0.2.19 \
    --add-module=/opt/nginx/modules/set-misc-nginx-module-0.29 \
    --add-module=/opt/nginx/modules/memc-nginx-module-0.16 \
    --add-module=/opt/nginx/modules/srcache-nginx-module-0.30 \
    --add-module=$(MODULESDIR)/headers-more-nginx-module \
    --add-module=$(MODULESDIR)/nginx-auth-pam \
    --add-module=$(MODULESDIR)/nginx-cache-purge \
    --add-module=$(MODULESDIR)/nginx-dav-ext-module \
    --add-module=$(MODULESDIR)/nginx-echo \
    --add-module=$(MODULESDIR)/nginx-http-push \
    --add-module=$(MODULESDIR)/nginx-lua \
    --add-module=$(MODULESDIR)/nginx-upload-progress \
    --add-module=$(MODULESDIR)/nginx-upstream-fair \
    --add-module=$(MODULESDIR)/ngx_http_substitutions_filter_module


vim debian/changelog
### PREPEND this:
nginx (1.9.3-1+trusty1) trusty; urgency=high

  * My custom build
  * Added extra modules to full package:
    --with-http_secure_link_module \
    --with-http_ssl_module \
    --with-http_stub_status_module \
    --add-module=/opt/nginx/modules/ngx_devel_kit-0.2.19 \
    --add-module=/opt/nginx/modules/set-misc-nginx-module-0.26 \
    --add-module=/opt/nginx/modules/memc-nginx-module-0.15 \
    --add-module=/opt/nginx/modules/srcache-nginx-module-0.30 \
    --add-module=$(MODULESDIR)/headers-more-nginx-module \
    --add-module=$(MODULESDIR)/nginx-cache-purge \
    --add-module=$(MODULESDIR)/nginx-http-push \
    --add-module=$(MODULESDIR)/nginx-lua \
    --add-module=$(MODULESDIR)/nginx-upload-progress \

 -- Florin Patan <florinpatan@gmail.com> Mon, 24 Aug 2015 15:53:00 +0100


vim debian/control
## CHANGE under nginx-full and nginx-full-dbg
Depends: nginx-common (= ${source:Version}), ${misc:Depends}, ${perl:Depends}, ${shlibs:Depends}

dpkg-buildpackage -b

cd ../ && ls -alh .
@iamkingsleyf

This comment has been minimized.

Copy link

commented Oct 8, 2015

Hello;

wont this break my site?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.