Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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
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.