JavaEar 专注于收集分享传播有价值的技术资料

Apache + php-fpm vs Nginx + php-fpm

I have a wallpaper website (almost all traffic goes to images). I use the following apps to serve.

apache2 + php5.3 + CGI/FastCGI

I have recently read that Nginx is faster than Apache. Also, many people advise using php-fpm. Do you recommend me to move my website to

Nginx+php-fpm

or just make

apache2 + php-fpm?

1个回答

    最佳答案
  1. There definitely is a difference in performance of Apache and NGINX.

    Both have their strongsuits and their weaknesses but in general:

    If PHP has to do a lot of work Apache will actually be faster because mod_php is a part of the Apache itself and is really good integrated.

    The additional (f)cgi takes some time too when using Nginx and thus making it slower on PHP-heavy applications.

    Conclusion

    Do you only want to serve a lot of static data (like images) you are better of with NGINX, because if excells on static content.

    --> In your case I'd go with NGINX...don't forget to make good use of NGINX' caching-mechanisms!