syvex
syvex

Reputation: 7748

How to wait for existing PHP connections to close in Nginx?

For upgrading a site running nginx/php, we're following something similar to:

https://www.calazan.com/how-to-configure-nginx-so-you-can-quickly-put-your-website-into-maintenance-mode/

server {
    ...
    location / {
        if (-f /siteroot/maintenance_on.html) {
            return 503;
        }


        ...
    }


    # Error pages.
    error_page 503 /maintenance_on.html;
    location = /maintenance_on.html {
        root /siteroot/glucosetracker/;
    }
    ...
}

My question is, after I create maintenance_on.html, how can I wait for any outstanding PHP connections to close?

Upvotes: 1

Views: 84

Answers (1)

itpp13
itpp13

Reputation: 454

You can use netstat in a script to test for open connections and loop until they are closed before performing maintenance. Or forcefully close them.

Upvotes: 1

Related Questions