When comparing Apache vs Nginx, the Slant community recommends Nginx for most people. In the question“What are the best web servers?” Nginx is ranked 1st while Apache is ranked 4th.
Specs
Ranked in these QuestionsQuestion Ranking
Pros
Pro Free and open source
Pro Powerful
Apache has a lot of features and functionality.
Pro Excellent OS support
Pro Easy solutions for complex configurations
Due to it's maturity, Apache has a lot of features to cover a wide range of situations.
Pro Great documentation
Apache has thorough documentation.
Pro Free and open source
Pro Fast and built for scalability
Nginx is event-driven, asynchronous, non-blocking and single threaded (one master process + worker processes). This allows nginx to be manage resources more efficiently compared to thread-based models (like Apache).
Pro Lightweight
Nginx offers a more basic set of functions out of the box compared most web servers. Extra functionality can be added via modules.
Pro Highly efficient memory use
Pro Highly efficient CPU use
Pro Advanced load balancing and caching
Pro Event Based Request Handling
Does not fork/thread per request.
Pro Easily configurable
Configuration files are concise and simple.
Cons
Con Arcane configuration format
Configuration is as good as the manuals go. As soon as you have to configure it by yourself, it becomes a lot more difficult due to a rather obtuse system of configuration with long and confusing variable names, which has become infamous among web developers.
Con Process Based Request Handling
Each request opens a new process/fork to handle just that request (ver memory inefficient)
Con Extremely inneficient
Opens a new thread for each request. In practice this means that unless you use a proxy (nginx) you can only have a certain number of people on your site at a time, and is extremely inefficient on the server side.