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

I've installed NGINX with sudo apt-get install nginx and now I'd like to recompile it with the configure option --with-http_stub_status_module.

How can I do this, and is there a way I can not loose all of my /etc/nginx configuration?

Thanks! Tom.

share|improve this question
up vote 4 down vote accepted

Download the source from and unpack it. Use/path/to/your/nginx/binary -V to get your current configure line.

Modify it as you see fit, and run the configure file from the nginx source with your new configure line. Then run make, make install and make upgrade and you're all updated.

share|improve this answer
This sounds like the best solution! I'll try it out and let you know how it goes :-) Thanks! – tarnfeld Jun 12 '11 at 15:12
I am trying to run @Martin F's update and it will not let me. Did you run into any issues with this installation? I get through all the make steps, however, even after a reboot when I run nginx -v I still see: nginx: nginx version: nginx/1.0.10 nginx: TLS SNI support enabled nginx: configure arguments: --prefix=/etc/nginx --conf-path=/etc/nginx/nginx.conf --error-log-path=/var/log/nginx/error.log --http-client-body-temp-path=/var/lib/nginx/body --http-fastcgi-temp-path=/var/lib/nginx/fastcgi --http-log-path=/var/log/nginx/access.log --http-proxy-temp-path=/var/lib/nginx/proxy --http-scgi-temp- – chrishough Dec 3 '11 at 22:38
where is that configure file located? i cant find it to edit it – Kristian Mar 1 '12 at 15:19

I agree with "Martin F" -- he described the simplest and proven way to upgrade Nginx from the official sources.

However, some people would like to go "Debian way" of installing source packages. In this case, the scenario is as follows:

  1. You must have dpkg-dev, dpatch, devscripts installed
  2. Go to the directory where you build packages, e.g. /usr/src. Download Nginx package sources: apt-get source nginx=1.0.4
  3. Directory nginx-1.0.4 contains Nginx sources along with Debian package configuration, installation script, etc. If you just want to add another option to Nginx configuration command line, edit debian/rules file. Note that Nginx package comes in three flavors: extra, full and I don't remember the third. Choose whatever you like and modify its configuration.
  4. Update the ChangeLog: dch --local your-user-id 'Added perl module; Removed ipv6, mail, xslt modules'
  5. Build the package: debuild -us -uc -b

After this, you should have Debian packages (e.g. nginx-full_1.0.4-1your-user-id1_amd64.deb) in /usr/src. Just install the package of your choice with dpkg -i <file>

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.