How to always have the latest nginx version in Ubuntu/Debian

Mark Alan varia at e-healthexpert.org
Mon Mar 23 23:42:47 MSK 2009


I am attaching the procedure that we use to to always have the latest 
nginx version in Ubuntu/Debian.

M.

## -- start-of-procedure

# Install the current Nginx (Ubuntu 8.10 = Nginx/0.6.34 @ backports)
sudo aptitude -R install nginx= ; # the ending = means install & hold to 
   prevent automatic upgrades

# install needed ubuntu/debian compiling tools
sudo aptitude -R install build-essential libpcre3 libpcre3-dev 
libpcrecpp0 libssl-dev zlib1g-dev

# build & replace by the latest "debianized" Nginx 0.7.44
test -x $HOME/src/ || mkdir -p $HOME/src/ && cd $HOME/src/
# nginx's latest version: <http://sysoev.ru/nginx/download.html>
wget http://sysoev.ru/nginx/nginx-0.7.44.tar.gz
tar zxvf nginx-0.7.44.tar.gz

cd nginx-0.7.44
./configure --prefix=/etc/nginx \
	--sbin-path=/usr/sbin/nginx \
	--conf-path=/etc/nginx/nginx.conf \
	--error-log-path=/var/log/nginx/error.log \
	--pid-path=/var/run/nginx.pid \
	--lock-path=/var/lock/nginx.lock \
	--user=www-data \
	--group=www-data \
	--http-log-path=/var/log/nginx/access.log \
	--http-client-body-temp-path=/var/lib/nginx/body \
	--http-proxy-temp-path=/var/lib/nginx/proxy \
	--http-fastcgi-temp-path=/var/lib/nginx/fastcgi \
	--with-cc-opt=-O2 \
	--with-http_gzip_static_module \
	--with-http_ssl_module

# ensure that there is only one -O in CFLAGS and that it is -O2
sed -i '/CFLAGS/s/ \-O //g' objs/Makefile

make

# debian policy: use 'install' instead of 'cp' or 'mv'
sudo /usr/bin/install -s -m 755 -o root objs/nginx /usr/sbin/nginx.new 
&& sudo mv /usr/sbin/nginx /usr/sbin/nginx.old-"$(date +%Y%m%d-%H%M-%S)" 
&& sudo mv -v /usr/sbin/nginx.new /usr/sbin/nginx

sudo kill -15 $(pidof nginx) ; sudo /etc/init.d/nginx restart

## -- end-of-procedure





More information about the nginx mailing list