Ubuntu Gutsy - Installing Nginx via aptitude

Nginx is a popular 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 Gutsy Slice using the package manager 'aptitude'.


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

Versions

Aptitude has version 0.5.26 of Nginx which is a relatively recent version.

However, at the time of writing, the latest stable version of Nginx is 0.5.33. 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 this article 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 pcre.

Navigate

Now simply navigate to your IP address:

http://123.45.67.890

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

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

PickledOnion.

Article Comments:

charles commented Fri Dec 14 21:45:11 UTC 2007:

hah! beautifully minimalistic tutorial. i love it! all tutorials should be this easy

Matt commented Sat Apr 19 16:58:25 UTC 2008:

Is there a nice tutorial anywhere for having nginx and apache running together?

Alex and SuperJared talk about it briefly in the forums:

http://forum.slicehost.com/comments.php?DiscussionID=945&page=1#Item_0

Thanks

vj commented Wed Sep 03 12:04:06 UTC 2008:

When restarting nginx after changing configuraton, sometime "sudo /etc/init.d/nginx restart" does not seemed to work well. I don't know why, I spent few hours just to find out.

I concluded that the safe way to and stop and to start again.

  • sudo /etc/init.d/nginx restart
  • sudo /etc/init.d/nginx restart

Hope this might help another person.

Daniel Barreto commented Sun Dec 20 23:04:24 UTC 2009:

Anyone knows how to add a module to nginx once it is installed via aptitude? I mean, what can i do if I can't recompile from the source?

Want to comment?


(not made public)

(optional)

(use plain text or Markdown syntax)