How to: Install NginX

How to: Install NginX

If you want to Install NginX, we currently host a PPA that tries to keep up with the latest updates from NginX. Sometimes we make changes to the build when something breaks or doesn’t work but most of the time we use the same package that is provided by the NginX team. Below are the instructions on how to install NginX using our PPA or the NginX team´s.

I. Add our Repository

The first step is adding our repository to your Ubuntu install in order to get NginX. Below are the two repositories we maintain and the two repositories the NginX team maintains. Be sure to select / use only one of them.

Mainline Repositories:

sudo add-apt-repository ppa:cloudingenium/nginx-mainline

&

sudo add-apt-repository ppa:nginx/development

Stable Repositories:

sudo add-apt-repository ppa:cloudingenium/nginx-stable

&

sudo add-apt-repository ppa:nginx/stable

We obviously recommend our repositories as the information posted on the site pertains to those, but you may chose the NginX team’s repositories as most of the time we copy theirs into ours (only when we need different behavior do we make changes to the build but usually by the next release they’ve addressed the issues).

After you have added the repository, execute sudo apt-get update to get the latest binaries.

II. Install NginX

Thus far easy right? Well, now it is still easy but you need to decide which package to install. If you read our Custom NginX Distribution post you can find out more about the different packages and what they contain. Sometimes we recommend the basic NginX package, but in other cases you need extra modules found in the Extras package or you want to play with NAXSI to protect your server. The choice is yours! We are going to use the extras packages as we believe is the most complete one and a good place to start.

Simply execute: sudo apt-get install nginx-extras to get it install on your server

III. Configure NginX

Now it is time to configure NginX. This is probably the most tedious part of the installation. If you are not familiar with NginX you are going to need to read on how to properly configure the different sections and where those configuration files are stored. You will also need to decide on a number of options / settings that fine tune the performance and HTTP communication parameters of your new Web Server. Below is a small and quick getting started guide to orient you. This should help you figure out where to start so you can more quickly get up to speed with NginX:

  1. Open the main configuration file: /etc/nginx/nginx.conf
  2. Add your sites’ configuraiton files at: /etc/nginx/sites-available
  3. Make symbolic links to /etc/nginx/sites-enabled for the configuration sites you want to enable (like what Apache does)
  4. You can use common files and include them through the include directive.
  5. Files on the /etc/nginx/conf.d are included automatically so you can create different sections for ease of management instead of filling up your main configuration file.
Enhanced by Zemanta

You may also like...

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.