Now that more websites are switching to a set-up with nginx in the front and Apache in the back (or a different webserver doing a better job at serving static media than Apache), I was wondering the following:

Would it make sense to put static media on a dedicated server (running nginx), instead of running nginx in front of Apache?

I'm not talking about budget, maintenance, etc. (I know that running 2 servers is more expensive than running 1). What I mean is:

How would you fully optimize a system dedicated to serving static files? What things can be done on the hardware and software level to optimize for static files that can't be done on a system that's also running Apache?


You are right. Installing two servers instead of one should provide some advantage.

To be honest for serving static files I cannot see any advantage. For load balancing you can use either a dedicated load balancer or use DNS round robin. For fail-over you need some HA setup (see Pacemaker for more details).

So for serving static files I would take care on other elements like big bandwith of the Internet connection, fast HDD (or maybe a SDD) and more cores instead of much RAM (I wouldn't deny it). I would avoid virtualized server solutions and would take care to have sendfile installed and configured.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.