HAProxy with HTTPD or Nginx as Revers Proxy

Posted June 19, 2018 3.7k views

I want to boost up my website so i do a bit research on this. I’ve found many options such as :

  • Setup Nginx as reverse proxy by forward dynamic requests to HTTPD or php-fpm : For this which one is best option ? Can i setup php-fpm on few droplets as processing power and Nginx forward dynamic request to these php-fpm pool. I’ve searched on google about this but mostly only different pool on same machine not separate machine.

  • if I setup HAProxy as load balancer to apache ? Does it better than first option ? For example : I have 1 droplet setup HAProxy and other 2 droplet setup HTTP. I’m concerned about source code of the projects. Do I need copy each source code to each droplet and keep each one up to date ?

  • If you have better web server architecture plz recommend .

  • Both options have their respective pros and cons. I personally use NGINX as my entry point for websites/applications as a reverse proxy and/or load balancer. My choice for this is I am familiar with NGINX as well as NGINX’s caching abilities.

    Currently I am starting to toy with NGINX as the frontend and using NGINX Unit as the backend application server.

  • “I’m concerned about source code of the projects. Do I need copy each source code to each droplet and keep each one up to date ? ”. Can you help clarify on this part ?

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Submit an Answer
1 answer


What you could do is setup Nginx as a reverse proxy for Apache and serve only the static files via Nginx.

You can follow the steps on how to do that here:

Or what you could try is using Nginx and PHP-FPM rather than adding an extra web service like Apache. You could follow the steps here:

I think the best way to test which one works better for your application is by doing some stress testing with both setups, here are a few great tools that you could use to do that:

Hope that this helps!

by Brian Boucheron
In this article, we'll talk about the server side of web performance optimization: how fast can your server respond to your user's requests? We'll review the general landscape of load testing, step through a plan to find your server's maximum practical response rate, and discuss some options for open source load testing software.