ubuntu nginx with txid module

Updated . Posted . Visible to the public. Repeats.

To install nginx with txid Show archive.org snapshot module

install nginx-full package:

sudo apt-get install nginx-full

download last nginx source:

wget http://nginx.org/download/nginx-1.9.9.tar.gz

examine what flags and modules your current nginx installed with:

nginx -V

you will see something like

nginx version: nginx/1.6.2 (Ubuntu)
TLS SNI support enabled
configure arguments: --with-cc-opt='-g -O2 -fPIE -fstack-protector-strong -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2' --with-ld-opt='-Wl,-Bsymbolic-functions -fPIE -pie -Wl,-z,relro -Wl,-z,now' --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-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_geoip_module --with-http_gzip_static_module --with-http_image_filter_module --with-http_spdy_module --with-http_sub_module --with-http_xslt_module --with-mail --with-mail_ssl_module --add-module=/build/nginx-gKBGMk/nginx-1.6.2/debian/modules/nginx-auth-pam --add-module=/build/nginx-gKBGMk/nginx-1.6.2/debian/modules/nginx-dav-ext-module --add-module=/build/nginx-gKBGMk/nginx-1.6.2/debian/modules/nginx-echo --add-module=/build/nginx-gKBGMk/nginx-1.6.2/debian/modules/nginx-upstream-fair --add-module=/build/nginx-gKBGMk/nginx-1.6.2/debian/modules/ngx_http_substitutions_filter_module

copy output to your editor for later use.

extract nginx source

tar –xvf nginx-1.9.9.tar.gz

cd to it

cd nginx-1.9.9

install required dependencies

sudo apt-get install build-essential

clone txid git repo into the current folder

git clone git@github.com:streadway/ngx_txid.git

go to your editor and prepare configuration parameters based on the output copied here previously

./configure --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-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_geoip_module --with-http_gzip_static_module --with-http_image_filter_module --with-http_v2_module --with-http_sub_module --with-http_xslt_module --with-mail --with-mail_ssl_module --add-module=ngx_txid

now run this command in current folder. Note that we use --with-http_v2_module instead of --with-http_spdy_module and add --add-module=ngx_txid at the end

install libgd-dev in case of this error:
./configure: error: the HTTP image filter module requires the GD library.

install libgeoip-dev in case of:
./configure: error: the GeoIP module requires the GeoIP library.

install libssl-dev in case of:
./configure: error: SSL modules require the OpenSSL library.

install libpcre++-dev in case of:
./configure: error: the HTTP rewrite module requires the PCRE library.

install libxslt1-dev in case of:
./configure: error: the HTTP XSLT module requires the libxml2/libxslt

after success of ./configure run

make
sudo make install

and now newely builded nginx binary can be found here: /usr/share/nginx/sbin/

check that this binary builded correctly:

/usr/share/nginx/sbin/nginx -V

output will be like

nginx version: nginx/1.9.9
built by gcc 4.9.2 (Ubuntu 4.9.2-10ubuntu13) 
built with OpenSSL 1.0.1f 6 Jan 2014
TLS SNI support enabled
configure arguments: --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-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_geoip_module --with-http_gzip_static_module --with-http_image_filter_module --with-http_v2_module --with-http_sub_module --with-http_xslt_module --with-mail --with-mail_ssl_module --add-module=../ngx_txid

now stop nginx

sudo service nginx stop

and change the binaries:

sudo mv /usr/sbin/nginx /usr/sbin/nginx_back
sudo mv /usr/share/nginx/sbin/nginx /usr/sbin/nginx

check that everything is as expected

nginx -V

output should be like

nginx version: nginx/1.9.9
built by gcc 4.9.2 (Ubuntu 4.9.2-10ubuntu13) 
built with OpenSSL 1.0.1f 6 Jan 2014
TLS SNI support enabled
configure arguments: --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-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_geoip_module --with-http_gzip_static_module --with-http_image_filter_module --with-http_v2_module --with-http_sub_module --with-http_xslt_module --with-mail --with-mail_ssl_module --add-module=../ngx_txid

and finally start our fresh compiled nginx

sudo service nginx start

now nginx sources can be removed:

cd ..
rm -rf nginx-1.9.9
konjoot
Last edit
konjoot
Posted by konjoot to wiki (2016-02-07 10:07)