Ubuntu Intrepid - Installing Nginx via aptitude

Nginx is a popular lightweight server for those who do not need the bulk and extra services that Apache may offer.

This article will look at installing Nginx on an Ubuntu Intrepid Slice using the 'aptitude' package manager.


Using the inbuilt package manager to install packages is a great idea as it solves dependency issues and you are assured of any security updates if, and when, they occur.

However, one drawback can be that it is rare for a version upgrade to be placed into the repositories. As such, it is possible for a newer version of an application to be released and not be placed into the repository.

Versions

Using aptitude, Ubuntu Intrepid will install Nginx version 0.6.32.

However, at the time of writing, the latest stable version of Nginx is 0.6.35. You can check the latest versions and change logs at the main nginx site.

Which one you choose is, of course, entirely up to you.

If you decide you would rather have a later version of Nginx than the one aptitude provides, then please refer to the sister article (link on the way) which will take you through the process of installing Nginx from source.

Install and Dependencies

Installing Nginx is incredibly simple as it involves one command:

sudo aptitude install nginx

This will install any and all dependencies that Nginx requires, such as libpcre.

Start

One odd thing is that Nginx is not started automatically:

sudo /etc/init.d/nginx start

Done.

Navigate

Now simply navigate to your IP address, and you will see the wonderfully simple welcome screen:

Nginx Welcome Screen

Init scripts

As you would imagine when installing an application with the aptitude package manager, all init scripts have been created and added to the relevant run levels.

Controlling nginx is done with these commands:

sudo /etc/init.d/nginx start
...
sudo /etc/init.d/nginx stop
...
sudo /etc/init.d/nginx restart

That's it.

Summary

Using the aptitude package manager makes the installation of Nginx and associated dependencies very simple indeed.

The only thing to consider is the version disparity between the one offered by aptitude and the one available via source code.

Mike

Article Comments:

DV commented Wed Mar 04 10:16:00 UTC 2009:

If you want to have PHP support with nginx, you should go with PHP-FPM (http://php-fpm.anight.org/). It involves a little more work, but the results are worthwhile!

Alex commented Mon Jun 29 23:53:42 UTC 2009:

This site http://www.linuxspace.org/archives/1576 is good too about nginx

Maurice commented Mon Jan 18 15:49:53 UTC 2010:

nginx is in the universe repository (as of Karmic), which you may have to enable.

Nomad Radio commented Tue Mar 16 10:56:35 UTC 2010:

From the nginx wiki:

Jeff Waugh maintains recent versions of Nginx in his PPA.

echo "deb http://ppa.launchpad.net/jdub/devel/ubuntu hardy main" >> /etc/apt/sources.list apt-key adv --keyserver keyserver.ubuntu.com --recv-keys E9EEF4A1 apt-get update apt-get install nginx

...presumably better than the standard ubuntu repo :-) Off to try it now!

Drew LeSueur commented Fri Jan 28 03:06:57 UTC 2011:

Where is the config file? where is nginx.conf?

Jered commented Mon Jan 31 21:33:02 UTC 2011:

The nginx.conf file should be in the /etc/nginx directory.

Want to comment?


(not made public)

(optional)

(use plain text or Markdown syntax)