Yes, you absolutely need nginx before Apache. Apache uses 1 thread or process for each connection. Each of these threads takes up memory. If you have several hundred people visiting your site and you have keepalive enabled, each of these browsers will support the apache process or the thread occupied by the memory on your server.
You can work around this by disabling keepalive on your apache server, but this slows down the performance of your website as browsers cannot reuse connections.
So, instead of nginx, you are using a reverse proxy with keepalive enabled. It can support thousands of connections with a small amount of memory (about 8 megabytes). Since nginx is local to your apache server, each request only takes a child or apache thread for several microseconds. This means that you can serve thousands of people with only a tiny fraction of apache processes.
In addition, nginx configuration is much more flexible than apache, and thanks to its presence on the front panel, it gives you more flexibility.
Mark maunder
source share