The nginx main configuration file, nginx.conf, controls how nginx runs. When nginx starts, it reads this file. It first processes the main context, then the events block where it sets how many connections each worker can handle. Next, it reads the http block, which contains server blocks. Each server block defines which port to listen on and how to handle requests. For example, setting worker_processes to 1 means nginx runs one worker process. Setting worker_connections to 1024 means each worker can handle up to 1024 connections. The listen directive inside a server block tells nginx which port to accept requests on, such as port 80 for HTTP. After parsing all directives, nginx starts the worker processes and begins serving requests. This flow ensures nginx is configured correctly before it runs.