-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy patheasy-maintenance-mode-with-nginx.html
100 lines (79 loc) · 4.56 KB
/
easy-maintenance-mode-with-nginx.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
<!DOCTYPE html>
<html lang="en">
<head>
<title>Easy maintenance mode with nginx</title>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/pure/0.6.0/pure-min.css" />
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/pure/0.6.0/grids-responsive-min.css" />
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.4.0/css/font-awesome.min.css" />
<link rel="stylesheet" href="./theme/css/main.css" />
<link href="https://shanedowling.com/feeds/all.atom.xml" type="application/atom+xml" rel="alternate" title="Shane Dowling Full Atom Feed" />
<link href="https://shanedowling.com/feeds/all.rss.xml" type="application/rss+xml" rel="alternate" title="Shane Dowling Full RSS Feed" />
<link href="https://shanedowling.com/feeds/category.slug.atom.xml" type="application/atom+xml" rel="alternate" title="Shane Dowling Categories Atom Feed" />
<link href="https://shanedowling.com/feeds/category.slug.rss.xml" type="application/rss+xml" rel="alternate" title="Shane Dowling Categories RSS Feed" />
</head>
<body>
<div class="main-nav-container">
<div class="pure-g">
<div class="pure-u-1 pure-u-lg-2-3">
<div class="main-nav">
<ul class="main-nav-list">
<li class="main-nav-item"><a href="./" class="pure-menu-link">Shane Dowling</a></li>
<li class="main-nav-item active"><a href="./category/posts.html" class="pure-menu-link">posts</a></li>
</ul>
</div>
</div>
<div class="pure-u-1 pure-u-lg-1-3"></div>
</div>
</div>
<div class="page-container">
<div class="entry-content">
<div class="post-meta pure-g">
<div class="pure-u-3-4 meta-data">
<a href="./category/posts.html" class="category">posts</a><br />
<a class="author" href="./author/shane-dowling.html">Shane Dowling</a>
— <abbr title="2018-08-20T00:00:00+02:00">Mon 20 August 2018</abbr>
</div>
</div>
</div>
<div class="article-header-container">
<div class="background-image-container">
<div class="background-image-small">
<div class="title-container">
<h1>Easy maintenance mode with nginx</h1>
</div>
</div>
</div>
</div>
<div class="entry-content">
<p>So I combined a few solutions I found online to come up with a quick way to
set up maintenance mode using nginx. Ideally it shouldn’t…
date: '2018-08-20T18:51:42.074Z'
categories: []
keywords: []
slug: /@shano/easy-maintenance-mode-with-nginx-2d4d510a0980</p>
<hr>
<p>So I combined a few solutions I found online to come up with a quick way to set up maintenance mode using nginx. Ideally it shouldn’t happen but in times of emergency in can be good to knock up a quick maintenance page for everyone but your own internal ips.</p>
<h3>Nginx Config</h3>
<p>So here’s the configuration I use for nginx, it starts with setting the internal ips of your company in the main nginx config file. Then in the actual vhost, you can set it to watch for the existence of a maintenance_on.html and when it exists, throw a 503 and use the maintenance page as your 503 error page.</p>
<h3>How to use</h3>
<p>By default I have the file named as maintenance_off.html, so it’s only a simple move operation to turn on maintenance mode. For the content of my maintenance file, I generally use this self-contained static html file to serve out a message to customers.</p>
<p><strong>Note</strong>: Any sort of conditionals going on on your web server is likely to slow things down by a few milliseconds. Again you’re asking your web server to check against network and the disk per request, then make a decision, so bear this in mind before implementing a solution like this.</p>
</div>
<footer>
<div class="pure-g post-footer">
<div class="pure-u-1 pure-u-md-1-2">
<div class="pure-g poster-info">
<div class="pure-u-3-4">
<h3 class="author-name"><a href="./author/shane-dowling.html">Shane Dowling</a></h3>
<p class="author-description">
</p>
</div>
</div>
</div>
</div>
</footer>
</div>
</body>
</html>