Introduction:
Nginx (pronounced "engine x") is an open source reverse proxy server for HTTP, HTTPS, SMTP, POP3, and IMAP protocols, as well as a load balancer, HTTP cache, and a web server (origin server). The nginx project started with a strong focus on high concurrency, high performance and low memory usage.it runs on Linux, BSD variants, Mac OS X, Solaris, AIX, HP-UX, as well as on other *nix flavors.Nginx has one master process and several worker processes. The main purpose of the master process is to read and evaluate configuration, and maintain worker processes. Worker processes do actual processing of requests.The number of worker processes is defined in the configuration file and may be fixed for a given configuration or automatically adjusted to the number of available CPU cores.
==================================================
Controlling Nginx
==================================================
1-> service nginx start // to start nginx service.
2-> service nginx stop // stop nginx services.
3-> service nginx reload // to reload the configration
4-> service nginx status // to show the status of nginx
5-> ps -ef | grep nginx // list all nginx running processes.
==================================================
Nginx Process Roles
==================================================
The master process is responsible for the following tasks:
1-> reading and validating configuration
2-> creating, binding and closing sockets
3->starting, terminating and maintaining the configured number of worker processes
4-> reconfiguring without service interruption
5-> re-opening log files
The worker processes accept, handle and process connections from clients, provide reverse proxying and filtering functionality and do almost everything else that nginx is capable of. In regards to monitoring the behavior of an nginx instance, a system administrator should keep an eye on workers as they are the processes reflecting the actual day-to-day operations of a web server.
===================================================
Nginx Configuration
===================================================
nginx configuration is kept in a number of plain text files which typically reside in /usr/local/etc/nginx or /etc/nginx. The main configuration file is usually called nginx.conf.
The configuration files are initially read and verified by the master process. A compiled read-only form of the nginx configuration is available to the worker processes as they are forked from the master process. Configuration structures are automatically shared by the usual virtual memory management mechanisms.
===================================================
Nginx Logs
===================================================
all nginx log file are in the directory /var/log/nginx/.