Skip to content

Nginx

Nginx is an HTTP web server, reverse proxy, content cache, load balancer, TCP/UDP proxy server, and mail proxy server.

Visit official Nginx documentation for more details.

Configuration

Nginx configuration is stored in the ${onteon_node_manager_path}/store/drbd/onteon-ha-resource-0/nginx/conf (by default /usr/local/bin/onteon-node-manager/store/drbd/onteon-ha-resource-0/nginx/conf) directory.

Initially it consists of:

  • html - web development files (e.g. HTML, CSS, JS).
  • lua-lib - Lua libraries for Nginx.
  • mimes - MIME types.
  • modsecurity - ModSecurity (WAF) files.
  • modules - Nginx modules written in C.
  • nginx.conf - main Nginx configuration file.
  • sites-available - servers configurations.
  • sites-enabled - links from sites-available for servers, which are enabled.

Logs

Nginx logs files are stored in the ${onteon_node_manager_path}/log/app/nginx-generic/ (by default /usr/local/bin/onteon-node-manager/log/app/nginx-generic/) directory.

  • Access Log - ${onteon_node_manager_path}/log/app/nginx-generic/access.log (by default /usr/local/bin/onteon-node-manager/log/app/nginx-generic/access.log).
  • Error Log - ${onteon_node_manager_path}/log/app/nginx-generic/error.log (by default /usr/local/bin/onteon-node-manager/log/app/nginx-generic/error.log).

Example Load Balancer Configuration

In-File Configuration

The following configuration should be placed in the http {} block

In-File Upstream

In upstream define list of servers, between which the Nginx will load balancer.

upstream my_applications {
    server 127.0.0.2:8080;
    server 127.0.0.3:8081;
}

In-File Server

In server, configure the load balancing using created upstream.

server {
    access_log /usr/local/bin/onteon-node-manager/log/app/nginx-generic/access.log main;
    server_name test_server;
    listen 8080;
    location / {
        proxy_pass http://my_applications;
        proxy_set_header Host $host;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_forwarded_for;
    }
}

Web GUI Configuration

Go to the Add Sites tab.

Web GUI Server

In server, configure the load balancing using created upstream.

Add server directives:

  • access_log
  • server_name
  • listen

Web GUI Example Server

Web GUI Location

Set the location's Path and Content.

Web GUI Example Location

Web GUI Upstream

In upstream define list of servers, between which the Nginx will load balancer.

Create upstream and give it a name. Then add server directives and pass the addresses of target servers.

Web GUI Example Upstream