Sign up ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

How to update nginx with adding module without deleting old nginx files/configs?

I installed nginx with apt-get install, i tried install by downloading tar.gz from nginx site but it doesnt gave any effect.

I'm using debian 6.0.2 squeeze

I would be grateful for advice.

Best Regards

share|improve this question

1 Answer 1

up vote 2 down vote accepted

If you want new modules, you'll have to recompile your nginx. If you want to install it from source, you'll have to remove the Debian package first. Here's a short tutorial for you. I'm performing everything as root user in the following:

Create a backup of your configuration files:

mkdir ~/nginx-config-backup && cp -r /etc/nginx/* ~/nginx-config-backup

Remove previous nginx installation:

apt-get remove nginx*

You'll need this to build nginx from source:

apt-get install build-essentials

The directory where we'll put the source files:

cd /usr/local/src

Get latest development version of nginx:

tar -zxvf nginx-1.3.9.tar.gz
mv nginx-1.3.9 nginx
rm -f nginx-1.3.9.tar.gz

Get latest PCRE version:

cd ../../lib
tar -zxvf pcre-8.31.tar.gz
mv pcre-8.31 pcre
rm -f pcre-8.31.tar.gz

Get latest OpenSSL version:

tar -zxvf openssl-1.0.1c.tar.gz
mv openssl-1.0.1c openssl
rm -f openssl-1.0.1c.tar.gz

Get latest zlib version:

git clone git://

Now I download two example modules for nginx:

cd ../includes
git clone git://
git clone git://

Back to nginx; we configure our installation and compile + install it:

cd ../src/nginx
make install

Don't forget to clean up everything:

cd /usr/local
rm -rf

You'll now have a working nginx binary at /usr/sbin/nginx. Also make sure to update your init-script (at /etc/init.d/nginx) for nginx. Here's—as an example—my personal init-script:

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.