0

I'm currently configuring a high availability setup using Keepalived to manage failover between Nginx servers. As part of this setup, I need to implement a health check script to verify that Nginx is running and that the backend sites served by Nginx are reachable.

The current script I have in place uses killall -0 nginx to check if the Nginx process is running. However, I'm unsure if this is the most effective method for ensuring Nginx functionality and backend site reachability.

Would using a script that employs curl to send a HEAD request to the Nginx server be a better approach? Here's the modified script I'm considering:

vrrp_script check_nginx {
script "/usr/bin/curl --silent --head --fail http://localhost:80/ || exit 1"
interval 2
}

Is this alternative method more robust and reliable for verifying Nginx functionality and backend site reachability within a Keepalived script? Are there any potential drawbacks or better alternatives that I should consider? Any insights or recommendations would be greatly appreciated. Thank you!

3
  • welcome, have you read the manual of nginx?
    – djdomi
    Commented Mar 24 at 7:08
  • Hi djdomi, I've read what the Nginx Plus manual had to say which included some examples of high availability setups but it did not satisfactorily answer this particular question, nor did it give me confidence that the way Nginx Plus did HA was compatible with the way Nginx community implements HA. The community manual left things to be desired as far as answers, but maybe I'm wrong! I'd love to be more informed if you would like to lead the way. Seems like a simple enough question to directly answer though?
    – Tmanok
    Commented Mar 26 at 7:43
  • theres no difference in the configuration as i seen and know correctly. only in avaiblity of modules - to follow up: take this also as a noticable source
    – djdomi
    Commented Mar 26 at 10:06

0

You must log in to answer this question.