3

Current Setup Single CentOS 6 VPS with 6G memory running apache 2.2, mariadb & PHP via FastCGI. Server has mostly wordpress sites, but also has some other PHP based sites. Right now we are not using HTTPS for any site, but plan to add it for authentication on PHP based sites.

  1. Are there any advantages to adding Nginx as reverse proxy (with or without caching) for static contents in front of apache + FastCGI on the same physical server? Apache does not have mod_php loaded, so it is already serving static pretty fast.
    1a. What are the possible advantages of keeping apache in middle and keeping the apache-php relation to FastCGI.
    1b. If we change the Apache-FastCGI, into Apache-mod_php, will there be any benefits? As apache's only task right now is serving dynamic contents, so will mod_php improve performance? As in case of Apache-FstCGI, apache has to ask a separate process (FastCGI) for parsing php, and in mod_php, apache process can parse php directly.
    1c. Which server should handle the SSL stuff?
  2. If the apache is removed from the middle, and Nginx directly use php-fpm for dynamic contents, will there be any advantages?
  3. We are considering getting CloudFlare free plan to add CDN, so does it makes any sense to add nginx if there is CloudFlare at the front?
2

1) Yes, mostly when apache handles slow HTTP clients: apache is designed in a way when its child blocks until he serves one client, thus its unable to serve others. So, if you have lots of clients, apache children will stack, consuming memory/CPU and probably hitting the children cap, making this situation a DoS.

1a) I see none.

1b) Yes, php module is way faster by design. But this speed is only visible in mathematics, not in file operations. So I recommend to get rid of apache and use nginx + FastCGI.

1c) Doesn't realy matter, however I suppose this should be first server in chain, since it's more handy.

2) Yes. Speed (with any sort of the client), static file operations, caching, lesser memory consumption. I bet you will see the difference without any benchmarking tool.

3) I'd say I see no need to use CloudFlare CDN. If you would really need it - you would already get rid of apache. Since you didn't - it means that the load is low on your web servers. But if you insist on answering the question - I doubt. I doubt there's really the need of doing something if you're happy with how the things are now. I say this without any sarcasm.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.