How to install nginx on Ubuntu

How to install nginx on Ubuntu 14.04

SecurityCategory
3 min read
Stephani Worts

Nginx isn't just a web server with a funny name. It's also the web server responsible for hosting of some of the most frequently visited websites on the Internet today. In fact, Nginx (pronounced “engine-x”) has now surpassed Apache as the most-used web server for the top 1,000 websites (as measured by traffic). One of the main benefits of Nginx is that it is inherently resource-friendly, allowing it to run efficiently even on older machines. In addition to its primary use as a web server, Nginx can also be easily configured for use as a basic reverse proxy server should it be needed, adding to its appeal. Installation in the Ubuntu 14.04 environment is quick, simple, and easily handled through the Terminal.

In order to perform this task, you’ll need an active Ubuntu server, as well as an SSH client such as PuTTY (for Windows) or Terminal (Mac). We recommend a GoDaddy VPS if you’re just getting started, or a full dedicated server if you’re ready to take total control.

How to do it

To install Nginx on Ubuntu 14.04, follow these steps:

NOTE: If Nginx is installed alongside an Apache web server, significant conflicts might arise as both web servers access the same resources (port 80, for example). It's a better idea to install Nginx on a fresh server or one that has been re-provisioned.

1. Update your system.

Before you begin the installation of any software in Ubuntu, you should always update your computer's packaging index. This ensures you're working with the latest information and helps you avoid downloading and installing updates later in the process. To update the index, run this command in the Terminal:

sudo apt-get update

2. Install Nginx.

Once you've updated your system, you'll need to download and install all of the necessary Nginx files on your system. Execute the following command in the Terminal (note that you might be prompted to enter your Ubuntu root password before the installation can continue):

sudo apt-get install nginx

Unless you've changed the default installation settings, Nginx will automatically start once this setup process completes. If you need to start Nginx manually, execute the following command:

sudo service nginx start

3. Verify the installation.

After the above installation has finished, verify that Nginx has been properly installed in your Ubuntu 14.04 environment. You can do this by opening your Web browser and typing in either the domain name for your server or its IP address. If all has gone as planned, you'll see the Nginx landing page as a result ("Welcome to Nginx!") and a link to the software's official online documentation portal.

Products Used

Servers Blog Ad Image

Servers

Learn more