resolver 127.0.0.11 valid=1s; upstream service1 { zone service1 64k; server service1 resolve; } upstream service2 { zone service2 64k; server service2 resolve; } upstream etcd { zone etcd 64k; server etcd:2379 resolve; } match service1_ok { status 200; body ~ "Service 1: Status OK"; } match service2_ok { status 200; body ~ '{"service":"service 2"'; } server { listen 80; listen 443 ssl; ssl_certificate /root/swarmdemo.crt; ssl_certificate_key /root/swarmdemo.key; status_zone swarmdemo; proxy_connect_timeout 2s; proxy_read_timeout 2s; location / { proxy_pass http://service1; } location /service2.php { proxy_pass http://service2; } location @healthcheck_service1 { internal; proxy_pass http://service1; health_check uri=/healthcheck.php match=service1_ok interval=4s; } location @healthcheck_service2 { internal; proxy_pass http://service2; health_check uri=/service2.php match=service2_ok interval=4s; } location /showhealthcheck { proxy_pass http://$arg_ip/healthcheck.php; } } server { listen 2379; proxy_connect_timeout 2s; proxy_read_timeout 2s; location / { proxy_pass http://etcd; } } server { listen 8081; root /usr/share/nginx/html; location = /status.html { } location = / { return 302 /status.html; } location /status { access_log off; status; } location /upstream_conf { upstream_conf; } }