Skip to content

Instantly share code, notes, and snippets.

@kewogc
Last active December 21, 2017 13:46
Show Gist options
  • Save kewogc/ac8a516c79bf4c5d629f56c2431f5547 to your computer and use it in GitHub Desktop.
Save kewogc/ac8a516c79bf4c5d629f56c2431f5547 to your computer and use it in GitHub Desktop.
Install nginx 1.10.1 with modules on ubuntu 16.04 14.04 12.04
# ubuntu 16.04
apt-get install checkinstall libpcre3 libpcre3-dev zlib1g zlib1g-dbg zlib1g-dev libxslt-dev libgd-dev libgeoip-dev libpam0g-dev libpcre++-dev libperl-dev
# ubuntu 12.04
apt-get install checkinstall libpcre3 libpcre3-dev zlib1g zlib1g-dbg zlib1g-dev libxslt-dev libgeoip-dev libpam0g-dev libpcre++-dev libperl-dev libgd2-noxpm-dev
mkdir -p ~/sources
cd ~/sources && wget 'http://nginx.org/download/nginx-1.10.1.tar.gz' && tar -xzvf nginx-1.10.1.tar.gz && rm nginx-1.10.1.tar.gz
cd ~/sources && git clone https://github.com/FRiCKLE/ngx_cache_purge.git
cd ~/sources && git clone https://github.com/wandenberg/nginx-push-stream-module.git
cd ~/sources && git clone https://github.com/gnosek/nginx-upstream-fair.git
cd ~/sources && git clone https://github.com/yaoweibin/ngx_http_substitutions_filter_module.git
cd ~/sources && git clone https://github.com/stogh/ngx_http_auth_pam_module.git
cd ~/sources && wget 'https://github.com/openresty/set-misc-nginx-module/archive/v0.30.tar.gz' && tar -xzvf v0.30.tar.gz && rm v0.30.tar.gz
cd ~/sources && wget 'https://github.com/simpl/ngx_devel_kit/archive/v0.3.0.tar.gz' && tar -xzvf v0.3.0.tar.gz && rm v0.3.0.tar.gz
cd ~/sources && wget 'https://github.com/openresty/headers-more-nginx-module/archive/v0.30.tar.gz' && tar -xzvf v0.30.tar.gz && rm v0.30.tar.gz
cd ~/sources && wget 'https://github.com/arut/nginx-dav-ext-module/archive/v0.0.3.tar.gz' && tar -xzvf v0.0.3.tar.gz && rm v0.0.3.tar.gz
cd ~/sources && wget 'https://github.com/openresty/echo-nginx-module/archive/v0.59.tar.gz' && tar -xzvf v0.59.tar.gz && rm v0.59.tar.gz
cd ~/sources && wget 'https://github.com/openresty/lua-nginx-module/archive/v0.10.5.tar.gz' && tar -xzvf v0.10.5.tar.gz && rm v0.10.5.tar.gz
cd ~/sources && wget 'https://github.com/masterzen/nginx-upload-progress-module/archive/v0.9.1.tar.gz' && tar -xzvf v0.9.1.tar.gz && rm v0.9.1.tar.gz
cd ~/sources && wget 'http://luajit.org/download/LuaJIT-2.0.4.tar.gz' && tar -xzvf LuaJIT-2.0.4.tar.gz
cd ~/sources/LuaJIT-2.0.4 && make && make install
export LUAJIT_LIB=/usr/local/lib
export LUAJIT_INC=/usr/local/include/luajit-2.0
cd ~/sources/nginx-1.10.1
./configure \
--with-cc-opt='-g -O2 -fPIE -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2' \
--with-ld-opt='-Wl,-Bsymbolic-functions -fPIE -pie -Wl,-z,relro -Wl,-z,now,-rpath,/usr/local/lib' \
--prefix=/usr/share/nginx \
--conf-path=/etc/nginx/nginx.conf \
--http-log-path=/var/log/nginx/access.log \
--error-log-path=/var/log/nginx/error.log \
--lock-path=/var/lock/nginx.lock \
--pid-path=/run/nginx.pid \
--http-client-body-temp-path=/var/lib/nginx/body \
--http-fastcgi-temp-path=/var/lib/nginx/fastcgi \
--http-proxy-temp-path=/var/lib/nginx/proxy \
--http-scgi-temp-path=/var/lib/nginx/scgi \
--http-uwsgi-temp-path=/var/lib/nginx/uwsgi \
--with-debug \
--with-pcre-jit \
--with-ipv6 \
--with-sha1=/usr/include/openssl \
--with-md5=/usr/include/openssl \
--with-http_ssl_module \
--with-http_stub_status_module \
--with-http_realip_module \
--with-http_auth_request_module \
--with-http_addition_module \
--with-http_dav_module \
--with-http_flv_module \
--with-http_geoip_module \
--with-http_gunzip_module \
--with-http_gzip_static_module \
--with-http_image_filter_module \
--with-http_mp4_module \
--with-http_perl_module \
--with-http_random_index_module \
--with-http_secure_link_module \
--with-http_v2_module \
--with-http_sub_module \
--with-http_xslt_module \
--with-http_limit_req_module \
--with-mail \
--with-mail_ssl_module \
--with-stream \
--with-stream_ssl_module \
--with-threads \
--add-module=$HOME/sources/headers-more-nginx-module-0.30 \
--add-module=$HOME/sources/ngx_http_auth_pam_module \
--add-module=$HOME/sources/ngx_devel_kit-0.3.0 \
--add-module=$HOME/sources/set-misc-nginx-module-0.30 \
--add-module=$HOME/sources/ngx_cache_purge \
--add-module=$HOME/sources/nginx-dav-ext-module-0.0.3 \
--add-module=$HOME/sources/echo-nginx-module-0.59 \
--add-module=$HOME/sources/nginx-push-stream-module \
--add-module=$HOME/sources/nginx-upload-progress-module-0.9.1 \
--add-module=$HOME/sources/nginx-upstream-fair \
--add-module=$HOME/sources/ngx_http_substitutions_filter_module \
--add-module=$HOME/sources/lua-nginx-module-0.10.5 \
#make -j2
#sudo make install
## if updade exist nginx
## Stop processed nginx!!!!
# /etc/init.d/nginx stop
# mv /usr/sbin/nginx /usr/sbin/nginx.old
# mv /usr/share/nginx /usr/sbin/nginx
# /etc/init.d/nginx start
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment