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.
- Nginx (for static files) and Apache (for dynamic content)?
- nginx better than apache for dynamic content? [closed]
- Apache or NGINX for PHP?
- Nginx as reverse proxy to Apache with only dynamic content?
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.
- 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!)
- 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? - 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?
- What will I lose by migrating to Nginx?
- To make it short, what should I do?