6

If one were developing a website today (summer 2012), should you use Apache or Nginx for serving the dynamic content (PHP)?

What are pros and cons of Apache and Nginx for the following scenarios:

  1. using reverse-proxy from Nginx to Apache, straightup Nginx, straight-up Apache.
  2. Push notifications: What if you want to offer real-time functionality like chat or notifications?
  3. Operating systems: I choose Amazon EC2 instance with Linux AMI or Ubuntu as the OS, but would it matter if I were using a different service for the hosting?

This is considering there is no restriction of which version of Apache and Nginx can choose.

tim peterson
  • 23,653
  • 59
  • 177
  • 299
  • 2
    Best answer I can give: Try yourself. And no, changing servers in a runnning environment is not a good idea. – hakre Jul 20 '12 at 15:12
  • 4
    You seem to be under the impression that Nginx is *better* than Apache, when in fact it's just *different*. Apache is great in some areas, Nginx fills considerable voids in others. Keep in mind that Apache is much like IE - cobbled together over a long time by a lot of developers and as a result it has some unnecessary bloat - but it's still a good solid application and a lot of the bloat can be disabled/removed. Nginx is the new kid on the block so it's light and efficient, but lacks bits and pieces of advanced functionality. Remember when FF was 100 times faster than IE? 'nuff said, I feel. – DaveRandom Jul 20 '12 at 15:29
  • @DaveRandom thanks, I don't mean to give the impression that Nginx is better. I meant to ask a question, not give an opinion as I have virtually no experience with servers. Its just from googling and other SO threads, there seems to be a growing bias towards Nginx. The site i'm building is on Apache and I'd prefer not to switch but I don't want to **not** do something if it so clear it will prevent future headaches if my site grows. I doubt I need advanced functionality as I just installed the default Apache config, though perhaps you could clarify what you mean by advanced functionality? – tim peterson Jul 20 '12 at 15:38
  • Off the top of my head... I'm not aware of an Nginx implementation of [`mod_ident`](http://httpd.apache.org/docs/2.2/mod/mod_ident.html). Not that you would ever *use* it, but it's nice to know it's there. The main advantage Nginx (currently) gives you over Apache is performance. If you're not using under Apache and you want the performance then Nginx would (for the time being) be the better choice. But there are some bits of PHP you won't get (e.g. [`apache_request_headers()`](http://php.net/apache-request-headers)) since you'll be forced to run as CGI. – DaveRandom Jul 20 '12 at 15:57
  • @DaveRandom thanks, i'm not currently using any `apache_...()` function calls and don't even know what `mod_ident` is so, yeah I'm a low level user. Also is Nginx's `php_fpm` the same as `php_spawn-fcgi`? I've been confused about the distinction between those two. It seems that `php_fpm` is the preferred `mod_php` equivalent these days, yes/no? – tim peterson Jul 20 '12 at 16:57

0 Answers0