Hi there, I have Apache2 and Varnish on the same server, and I want to protect better my server against DDOS attacks. For this, I found HAProxy, and I would like to know if its a god idea to put Varnish and HAProxy on the same server ? I have 2Gb ram and 4 cores
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
I’ve never used Varnish myself but you certainly can run both on the same server. To do that, you need to free up port 80 for HAProxy and bind Varnish to another port.
Edit /etc/default/varnish and replace DAEMON_OPTS="-a :80 \ with DAEMON_OPTS="-a :8080 \. If Apache2 is listening on port 8080, you can configure Varnish to listen on another port such as 8888 or whatever port you like.
Then, install HAProxy and configure it to listen on port 80 and reverse proxy connections to 127.0.0.1:8080 where 8080 is the port that Varnish is listening on.
Keep in mind that HAProxy isn’t designed to protect from DDoS attacks but it can be configured to help in doing so.
Thank you so much for your response Kamal. I have one more question, do you think that will slow down my website to put 2 reverses proxy in front of my website ?
Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.
Full documentation for every DigitalOcean product.
The Wave has everything you need to know about building a business, from raising funding to marketing your product.
Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.
New accounts only. By submitting your email you agree to our Privacy Policy
Scale up as you grow — whether you're running one virtual machine or ten thousand.
Sign up and get $200 in credit for your first 60 days with DigitalOcean.*
*This promotional offer applies to new accounts only.