Using NginX and Apache alongside for both static and dynamic files

Posted by faridv on Server Fault See other posts from Server Fault or by faridv
Published on 2012-12-14T17:42:22Z Indexed on 2012/12/15 5:08 UTC
Read the original article Hit count: 462

Filed under:
|
|
|

Background:

I've searched a lot and found these useful threads about using of Apache or NginX for static or dynamic files. But they are old (mostly about 1 or 2 years ago) and I think both webservers, specifically Nginx has had important changes in performance and usage. So I think take another look on these issue cannot be that bad.

My question:

I have a PHP web application with lots of dynamic files and lots of static contents (videos, images etc.) and it's currently running on a CentOS 6 server and Apache 2.2 since 2 months ago.

In past few days, number of our site visitors have gained so fast and I just thought if this number continues to increase with current ratio, we need to change many things (web server, application, etc.) to prevent failures. Because of hardware limitations that we are facing, I thought that it's best for us to start with web server.

  1. Should I start with something else? Should I try to increase performance of my PHP application and forget about web server for now? (even if gonna take a long time!)
  2. Because of huge usage of .htaccess files (for redirection, rewrites, etc.), I think it's gonna be painful to migrate to NginX as default web server or maybe only for dynamic files. Does this mean that I can't even use Nginx as reverse proxy?
  3. I'm not sure latest stable version of NginX and PHP-FPM have a better performance over my current Apache and my limitations (too many things) won't let me to give it a try. Which one is doing better currently?
  4. What will I lose by migrating to Nginx?
  5. To make it short, what should I do?

© Server Fault or respective owner

Related posts about apache2

Related posts about php