Nginx – Summing up (Ubuntu 12.04 LTS) (original) (raw)

This article is part of our Academy Course titled Introduction to Nginx.

This course will introduce you to the magic of nginx. You will learn to install and configure nginx for a variety of software platforms and how to integrate it with Apache. Additionally, you will get involved with more advanced concepts like Load Balancing, SSL configuration and Websockets proxying. Check it out here!

1. Introduction

In this last tutorial we will review some key important facts about Nginx that we have discussed in depth on the previous ones.

2. Installation

The reasons why we have chosen to download the source code of the program and compile it manually for our production server (as opposed to using installation perform through a package manager, such as aptitude or yum, which we have also covered) are:

The compile time options (along with a brief description) can be displayed with:

sudo ./configure --help

Note that this command must be run in the directory where the source code was extracted (see Fig. 1). These compile time options can be classified under the following categories:

On occasions, the build process may fail due to missing prerequisites, unspecified or non-existent paths, or paths with wrong permissions (we need to make sure that the directory(ies) where we will install Nginx are writable).

Figure 1: The complete list of compile time options

Figure 1: The complete list of compile time options

3. Documentation and examples

The official website of the project does not provide a significant amount of information or documentation, other than links for downloading the latest versions. However, we can find a lot of interesting information, documentation and examples on the official wiki (see Fig. 2), which may prove very useful to us in many situations, and in the forums (see Fig. 3). Additionally, the Nginx mailing list, which is relayed on the Nginx forum, is an excellent resource for any question we may have; now, if we need direct assistance, there is always a bunch of regulars helping each other out on the IRC channel #Nginx on irc.freenode.net.

Figure 2: Nginx official wiki (wiki.nginx.org)

Figure 2: Nginx official wiki (wiki.nginx.org)

Figure 3: Nginx Forum (forum.nginx.org)

Figure 3: Nginx Forum (forum.nginx.org)

4. Troubleshooting

A small thing such as a typo in the main configuration file can cause us severe headaches. The first thing that we need to do after performing a change in the file nginx.conf is test it with the –t switch. Note that this command must be executed in the directory where the binary file is located (see Fig. 4). The output of this command will show whether the syntax of the configuration file is correct or the line and directive that needs to be corrected if it is not. Also, it is a good idea to keep an intact copy of your original nginx.conf while making changes in case of something unexpected happens.

Figure 4: Testing the nginx.conf file

Figure 4: Testing the nginx.conf file

Photo of Gabriel Canepa

Gabriel Canepa is a Linux Foundation Certified System Administrator (LFCS-1500-0576-0100) and web developer from Villa Mercedes, San Luis, Argentina. He works for a worldwide leading consumer product company and takes great pleasure in using FOSS tools to increase productivity in all areas of his daily work. When he's not typing commands or writing code or articles, he enjoys telling bedtime stories with his wife to his two little daughters and playing with them, the great pleasure of his life.