1

需要帮助我有这个

service {
  name = "nginx"
  tags = [ "nginx", "web", "urlprefix-/nginx" ]
  port = "http"
  check {
    type = "tcp"
    interval = "10s"
    timeout = "2s"
  }
}

如果返回 200 响应(如 localhost:8080/test/index.html),我如何为特定 URI 添加运行状况

4

1 回答 1

6

就像添加另一个检查一样简单,配置为使用http这样的检查/health,您的 nginx 在其发布的端口上提供服务:

service {
  name = "nginx"
  tags = [ "nginx", "web", "urlprefix-/nginx" ]
  port = "http"
  check {
    type = "tcp"
    interval = "10s"
    timeout = "2s"
  }
  check {
    type = "http"
    path = "/health"
    interval = "10s"
    timeout  = "2s"
  }
}

您可以在此处查看完整示例: https ://www.nomadproject.io/docs/job-specification/index.html

于 2019-11-07T06:03:54.583 回答