Hello, I'm Ganesh. I'm building git-lrc, an AI code reviewer that runs on every commit. It is free, unlimited, and source-available on Github. Star Us to help devs discover the project. Do give it a try and share your feedback for improving the product.
In the previous article, We have seen how to setup nginx on ubuntu and enable the site. It was more into basic where anyone one who wants to configure domain or any other thing can follow it.
Now in this article we will explore a how nginx works.
How Nginx Architecture and How they Works?
Before we go into how nginx works, we need to understand the architecture of nginx.
Nginx has two main components:
- Master Process
- Worker Process
Master process is to read, evaluate configuration files and maintain worker process.
Worker Process will do all the processing of client requests.
Nginx works on principle of event-based and OS-dependent mechanisms to efficiently distribute requests among worker processes.
The number of worker process can be configured in the nginx.conf file and this can also be automatically set based on the number of CPU cores available on the system.
For more information on how to configure the number of worker process, please refer to the official documentation Worker Processes.
By default, the configuration file is named nginx.conf and placed in the directory /usr/local/nginx/conf, /etc/nginx, or /usr/local/etc/nginx.
How to Start, Stop and Reload Nginx?
To Control any operation of nginx, we need to use the executable file.
This will be having this syntax:
nginx -s signal
Where signal may be one of the following:
- stop — fast shutdown
- quit — graceful shutdown
- reload — reloading the configuration file
- reopen — reopening the log files
For example, to stop nginx processes with waiting for the worker processes to finish serving current requests, the following command can be executed:
nginx -s quit
Conclusion
As of now we understand how Nginx architecture works and how to control Nginx.
In the next article, we will go in-depth on how to use these signals to control Nginx.
Any feedback or contributors are welcome! It’s online, source-available, and ready for anyone to use.
⭐ Star it on GitHub: https://github.com/HexmosTech/git-lrc

Top comments (0)