The Most Active and Friendliest
Affiliate Marketing Community Online!

“Adavice”/  “1Win

Nginx vs Apache2?

I've been running Nginx for a couple of months, my rep at my hosting company suggested I switched to apache2, he said he'd do optimization so it would run as fast as Nginx.

Don't delete the nginx server and duplicate it into an Apache2 stack. Then check both performances. Don't trust words, trust data.
 
Use the one you're comfortable with.

But, if you're going to use Apache:

  • turn off AccessOverride (put your .htaccess configs in the main httpd.conf, load them from another .conf or in a custom vhost.conf)
  • if using a mix of static HTML and PHP, use the Event MPM + PHP-FPM connecting via a unix socket
  • if using HTTPS, tune your TLS stack and take advantage of HTTP/2 (Apache 2.4.17+)
 
Nginx gets my recommendation, however a properly tweaked Apache configuration can compete. You can always do the 'ultimate combo' of Varnish & Nginx to make things even faster.

If you're running a database driven site though, you're also going to be dependent on the performance of your SQL server as well, so keep that in mind.
 
They are both good, you just have to trust the person managing it and have them back it up with some stats. In my exp nginx is better, but there are some interesting things happening with http2 and apache.

A good question is what are you hosting? Static site? WordPress? Are you using caching local or a CDN at all?

Those things are going to impact how much memory you need, file system io requirements, etc...

Let me know and I can help a bit more based on what we see day to day.
 
They are both good, you just have to trust the person managing it and have them back it up with some stats. In my exp nginx is better, but there are some interesting things happening with http2 and apache.

A good question is what are you hosting? Static site? WordPress? Are you using caching local or a CDN at all?

Those things are going to impact how much memory you need, file system io requirements, etc...

Let me know and I can help a bit more based on what we see day to day.

HTML, CSS and JS - so static.

I use CDN.

I get roughly 80-100k page hits per day, 2gb ram and 2 cpus, seems to work alright for me.
 
If one needs a low memory environment, then Nginx is better, but if one needs a wide range of configuration options, then Apache leads the way.
 
I've been running Nginx for a couple of months, my rep at my hosting company suggested I switched to apache2, he said he'd do optimization so it would run as fast as Nginx.
Now that's a joke. There's no way Apache can come near Nginx.
 
Now that's a joke. There's no way Apache can come near Nginx.

It can if you know what you're doing. Whether using Nginx or Apache, I can theoretically push 20k+/second static pages on a lowly 1CPU/768MB Vultr instance. But, I'd saturate the pipe way before I could handle that many clients. To a client browser, latency has the biggest impact on perceived performance i.e. page rendering. Besides, how many people are approaching anywhere near those levels of concurrency. Not many.

Now, when it comes to processing PHP files with either Nginx+PHP-FPM or Apache+PHP-FPM combination, the RPS is going to be exactly the same as both servers are sitting there waiting for the FastCGI process to end.
 
nginx all the way - In the beginning it can be a bit tricky to set it up properly but there is tons of info/resources online to guide you through it.
 
MI
Back