Skip to content

Instantly share code, notes, and snippets.

@rafaelss
Last active October 2, 2015 20:18
Show Gist options
  • Star 4 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rafaelss/2312669 to your computer and use it in GitHub Desktop.
Save rafaelss/2312669 to your computer and use it in GitHub Desktop.
Script to build nginx with some modules configured
#!/usr/bin/env bash
version="1.5.10"
pcre_version="8.34"
set -e
rm -rf nginx-$version*
# download nginx
wget http://nginx.org/download/nginx-$version.tar.gz
tar -zxvf nginx-$version.tar.gz
# compile pcre
cd nginx-$version/contrib
wget -O pcre-$pcre_version.tar.gz "http://downloads.sourceforge.net/project/pcre/pcre/$pcre_version/pcre-$pcre_version.tar.gz?r=&ts=1367323585&use_mirror=ufpr"
tar -zxvf pcre-$pcre_version.tar.gz
# clone extensions
cd ..
mkdir ext
cd ext
git clone --depth 1 git://github.com/simpl/ngx_devel_kit.git
git clone --depth 1 git://github.com/agentzh/set-misc-nginx-module.git
git clone --depth 1 git://github.com/agentzh/nginx-eval-module.git
git clone --depth 1 git://github.com/agentzh/echo-nginx-module.git
git clone --depth 1 git://github.com/chaoslawful/lua-nginx-module.git
# configure
cd ..
./configure --prefix=/opt/nginx --with-http_ssl_module \
--without-http_autoindex_module \
--without-http_geo_module \
--without-http_scgi_module \
--without-http_ssi_module \
--without-http_uwsgi_module \
--with-http_gzip_static_module \
--with-http_spdy_module \
--with-http_stub_status_module \
--add-module=ext/ngx_devel_kit \
--add-module=ext/set-misc-nginx-module \
--add-module=ext/echo-nginx-module \
--add-module=ext/lua-nginx-module \
--with-pcre=contrib/pcre-$pcre_version
make
sudo make install
# cleanup
cd ..
rm -rf nginx-$version*

Building

git clone https://gist.github.com/2312669.git nginx-build
cd nginx-build
./build.sh
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment