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




Using aptitude, Ubuntu will install Nginx.

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.


One odd thing is that Nginx is not started automatically:

sudo /etc/init.d/nginx start



Now simply navigate to your IP address, and you will see the wonderfully simple 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.


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.

© 2015 Rackspace US, Inc.

Except where otherwise noted, content on this site is licensed under a Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Unported License

See license specifics and DISCLAIMER