Basic NGINX Usage Guide

Hi everyone, I am looking for community guidance on basic usage of NGINX. Here is the context based on available documentation.

NGINX Product/Version

NGINX Open Source

Sanitized Configuration Excerpt

user nginx;
worker_processes auto;
error_log /var/log/nginx/error.log;
pid /run/nginx.pid;

events {
    worker_connections 1024;
}

http {
    include /etc/nginx/mime.types;
    default_type application/octet-stream;

    server {
        listen 80;
        server_name localhost;

        location / {
            root /usr/share/nginx/html;
            index index.html index.htm;
        }
    }
}

Expected Behavior

Clients accessing port 80 should be served the default index page from the root directory.

Actual Behavior

Behavior depends on specific system setup and environment configuration.

Relevant Logs

[notice] 1#1: using the "epoll" event method
[notice] 1#1: NGINX version: 1.24.0

Question

What are the recommended best practices when setting up server blocks and managing configurations for production environments in the NGINX community?

nginx #Webserver Community

1 Like