Basic Nginx HTTP server architecture tips

Some facts about the Nginx

Nginx or “engine X” is popular HTTP server (plus more). It is known for high performance, stability, rich feature set, simple configuration, and low resource consumption.

Here are all the configuration files for Nginx: ( rpm -qc nginx )





















Most important file from this list is of course nginx.conf.

Nginx Architecture

nginx.conf file defines the architecture of the Nginx server. There you define your Nginx configuration. By default, the configuration file is pretty “skinny” (very few details in it).

Nginx doesn’t rely on threads to handle requests—instead Nginx will execute a function for each request without creating threads. This makes it possible to handle thousands of requests with low memory consumption.

Nginx architecture is simple: worker processes manage the HTTP requests, but the core (main) Nginx process manages worker processes. You can state the number of worked processes directly in the Nginx configuration file. To evaluate the best number for these you can use this line:

processor /proc/cpuinfo |wc -l

Here is the configuration file for Nginx. Just follow the comments for more info.

user nginx; # the user

worker_processes 8; #should reflect the number of processes

error_log /var/log/nginx/error.log;

#error_log /var/log/nginx/error.log notice; # enable if you like

#error_log /var/log/nginx/error.log info;

pid /var/run/;

events {

	worker_connections  1024;  


There is a way to discover the Nginx process id. It is written in the file /var/run/; You can cat that file out to find your PID. I found the PID #2433.

To get the Nginx worker process IDs for the main process #2433 you would write:

pgrep -P 2433

Worker connections variable in the events sections determine the max number of connections that can be open by a worker process. (keep alive included)

CONCLUSION : This is just the basic Nginx HTTP introductory info; with just few concepts. Many other info can be found here.


tags: & category: -