worker_connections be placed to properly set the maximum number of simultaneous connections per worker process?The worker_connections directive belongs in the events context because it controls the maximum number of connections each worker process can handle. It is not part of http, server, or location contexts.
location block is placed directly inside the main context (outside http) and you run nginx -T to test the configuration?location /test {
proxy_pass http://localhost:8080;
}location blocks.The location directive is only valid inside the server context, which itself must be inside http. Placing it in the main context causes an emergency error on config test.
The main context is the global config. events handles connection limits. http processes HTTP settings. server matches the domain/port. location matches the request URI.
proxy_pass http://backend; directly inside the http context, but it has no effect on requests. Why?The proxy_pass directive must be inside a location block to apply to specific request URIs. Placing it directly in http does nothing.
gzip on; and gzip_types for best practice and efficient configuration?Placing gzip directives in the http context enables compression globally for all servers and locations, which is efficient and easier to manage.