qbbr.io / blog

Tags: ,
Source: markdown

configure

module ngx_http_geo_module can be installed!!!

geo $maintenance {
	default yes;
	# ip white list
	127.0.0.1 no;
	192.168.100.0/24 no;
}

server {
	# ...

	location / {
		if (-f /etc/nginx/maintenance.file) {
			set $tmp clo;
		}
		if ($maintenance = yes) {
			set $action "${tmp}se";
		}
		if ($action = close) {
			return 503;
		}

		# ...
	}

	error_page 503 /503.html;
}

use

touch /etc/nginx/maintenance.file - close site
rm /etc/nginx/maintenance.file - open site

comments powered by Disqus
On your computer does not found Web Browser!
Plz install it.
Firefox
Chromium
Google Chrome
Safari
Opera