haproxy.sh 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. #!/bin/bash
  2. clear
  3. if [[ "$EUID" -ne 0 ]]; then
  4. echo -e "\033[1;31mScript need to be run as root!\033[0m"; exit 1
  5. fi
  6. apt-get -qq update
  7. apt-get -y -qq install haproxy
  8. echo "global
  9. log /dev/log local0
  10. log /dev/log local1 notice
  11. chroot /var/lib/haproxy
  12. stats socket /run/haproxy/admin.sock mode 660 level admin expose-fd listeners
  13. stats timeout 30s
  14. user haproxy
  15. group haproxy
  16. daemon
  17. # Default SSL material locations
  18. ca-base /etc/ssl/certs
  19. crt-base /etc/ssl/private
  20. ssl-default-bind-ciphers ECDH+AESGCM:DH+AESGCM:ECDH+AES256:DH+AES256:ECDH+AES128:DH+AES:RSA+AESGCM:RSA+AES:!aNULL:!MD5:!DSS
  21. ssl-default-bind-options no-sslv3
  22. defaults
  23. log global
  24. mode http
  25. option httplog
  26. option dontlognull
  27. timeout connect 5000
  28. timeout client 50000
  29. timeout server 50000
  30. errorfile 400 /etc/haproxy/errors/400.http
  31. errorfile 403 /etc/haproxy/errors/403.http
  32. errorfile 408 /etc/haproxy/errors/408.http
  33. errorfile 500 /etc/haproxy/errors/500.http
  34. errorfile 502 /etc/haproxy/errors/502.http
  35. errorfile 503 /etc/haproxy/errors/503.http
  36. errorfile 504 /etc/haproxy/errors/504.http" > /etc/haproxy/haproxy.cfg
  37. echo
  38. echo -e "\033[1;32mCongratulation, We are done with the haproxy installation.\033[0m"
  39. echo
  40. echo 'Use my referral link https://m.do.co/c/a28a40414d6a'
  41. echo 'to gets $100 credit into your DigitalOcean account.'
  42. echo 'Created by Doctype, Powered by Cybertize'
  43. echo 'Copyright 2021, Allright reserved.'
  44. echo; sleep 5