Overview

Nginx is another application server, just like: Apache HTTP and Apache Tomcat. Unlike Tomcat, Nginx cannot be used for artifacts at the same time, Nginx is very stable and is compatible with another plugins and applications.

Installation

Installation of nginx is the same as apache and tomcat, you can use the yum repository as follows:

Required Libraries

After that, we can start with the configuration. The configuration files for nginx are located in: /etc/nginx

Configuration

The configuration files are in couple categories:

Nginx configuration

Site Configuration

Security Configuration

Nginx Configuration

Nginx configuration include how nginx works in terms of: how much connection works, in what format the log should be generated, where the access log should be located and so on. Additionally we have to put the other configuration file location:

Nginx Configuration

Site Configuration

The site configuration include: on which port it should listen, site name and others. Optionally you can include the security configuration also, however it isn't good practice to do so.

Site Configuration

Security Configuration

Although security configuration and site configuration can be all part of the nginx configuration. It is good to have these things separated. So the security configuration again includes on which port the SSL is enabled (by default 443) what cipher to be used:

Security Configuration

Once all has been set up, we can start the nginx server:

Check status

Automatic certificates

We can configure automatic re-certification using 3months certificates, usuing ACME client:

Install ACMD

Then we can install the certificate as follows:

Automatic Certificate

You can modify the location using parameter, refer to the help options:

ACME help options