Changed nginx to docker's nginx image
This commit is contained in:
parent
c63739ec42
commit
5b75da0aab
10
Dockerfile
10
Dockerfile
@ -1,12 +1,12 @@
|
||||
# NAME leenooks/nginx
|
||||
# VERSION latest
|
||||
# BUILD docker build -t="leenooks/nginx" .
|
||||
# START docker run -dp 80:80 -p 443:433 -v /srv/nginx/conf.d:/etc/nginx/conf.d [-v /srv/nginx/default.d:/etc/nginx/default.d] [--link web] --restart=always --name=nginx leenooks/nginx
|
||||
|
||||
FROM registry.leenooks.net/leenooks/base:7
|
||||
FROM nginx:latest
|
||||
COPY etc/nginx/default.d /etc/nginx/default.d
|
||||
COPY var/www/maintenance /var/www/maintenance
|
||||
|
||||
RUN yum -y install epel-release && yum clean all
|
||||
RUN yum -y install certbot nginx ln-nginx && yum clean all
|
||||
RUN apt-get update && apt-get install certbot -yyq \
|
||||
&& rm -rf /var/lib/apt/lists/* /tmp/*
|
||||
|
||||
EXPOSE 80 443
|
||||
|
||||
|
2
etc/nginx/default.d/01-no-default.conf
Normal file
2
etc/nginx/default.d/01-no-default.conf
Normal file
@ -0,0 +1,2 @@
|
||||
# Reject requests to undefined hosts
|
||||
return 444;
|
31
etc/nginx/default.d/02-maintenance.include
Normal file
31
etc/nginx/default.d/02-maintenance.include
Normal file
@ -0,0 +1,31 @@
|
||||
# Enable setting a maintenance mode and render the maintenance
|
||||
# page instead.
|
||||
#
|
||||
# Add this lines to your conf.d file for your site.
|
||||
#
|
||||
# include conf.d/02-maintenance.include;
|
||||
#
|
||||
# if ($maintenance) {
|
||||
# return 503;
|
||||
# }
|
||||
#
|
||||
# Create a default file in conf.d with these settings, or add them to your existing server
|
||||
# configuration
|
||||
#
|
||||
# error_page 502 =200 @maintenance;
|
||||
# error_page 503 =200 @maintenance;
|
||||
#
|
||||
# geo $maintenance {
|
||||
# default 0;
|
||||
# 10.1.0.0/16 0;
|
||||
# }
|
||||
|
||||
location @maintenance {
|
||||
root /var/www/maintenance;
|
||||
try_files $uri /maintenance.html =503;
|
||||
}
|
||||
|
||||
location @timeout {
|
||||
root /var/www/maintenance;
|
||||
try_files $uri /timeout.html =503;
|
||||
}
|
117
var/www/maintenance/maintenance.html
Normal file
117
var/www/maintenance/maintenance.html
Normal file
@ -0,0 +1,117 @@
|
||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
|
||||
"http://www.w3.org/TR/html4/loose.dtd">
|
||||
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-type" content="text/html;charset=UTF-8">
|
||||
<title>Site Maintenance</title>
|
||||
<style type="text/css">
|
||||
body{ text-align: center; padding-top: 50px; padding-left: 80px; font-family: sans-serif; font-weight: 100; font: 20px Helvetica, sans-serif; color: black; }
|
||||
h1{ font-size: 50px; font-weight: 100; font-size: 40px; margin: 40px 0px 20px; }
|
||||
#article{ display: block; text-align: left; margin: auto; }
|
||||
a{ color: #dc8100; text-decoration: none; }
|
||||
a:hover{ color: #333; text-decoration: none; }
|
||||
#clockdiv{ font-family: sans-serif; color: #fff; display: inline-block; font-weight: 100; text-align: center; font-size: 30px; }
|
||||
#clockdiv > div{ padding: 10px; border-radius: 3px; background: #00BF96; display: inline-block; }
|
||||
#clockdiv div > span{ padding: 15px; border-radius: 3px; background: #00816A; display: inline-block; }
|
||||
.smalltext{ padding-top: 5px; font-size: 16px; }
|
||||
</style>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div id="article">
|
||||
<h1>We’ll be back very soon!</h1>
|
||||
<img src="/maintenance.jpg" />
|
||||
<div>
|
||||
<p>Sorry for the inconvenience but we’re making some important changes. It shouldn’t take very long.</p>
|
||||
<p>We plan to be back online within 15 minutes.</p>
|
||||
<div id="clockdiv">
|
||||
<div>
|
||||
<span class="minutes"></span>
|
||||
<div class="smalltext">Minutes</div>
|
||||
</div>
|
||||
<div>
|
||||
<span class="seconds"></span>
|
||||
<div class="smalltext">Seconds</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<script type="text/javascript">
|
||||
//<![CDATA[
|
||||
function getTimeRemaining(endtime) {
|
||||
var t = Date.parse(endtime) - Date.parse(new Date());
|
||||
var seconds = Math.floor((t / 1000) % 60);
|
||||
var minutes = Math.floor((t / 1000 / 60) % 60);
|
||||
return {
|
||||
'total': t,
|
||||
'minutes': minutes,
|
||||
'seconds': seconds
|
||||
};
|
||||
}
|
||||
|
||||
function initializeClock(id, endtime) {
|
||||
var clock = document.getElementById(id);
|
||||
var minutesSpan = clock.querySelector('.minutes');
|
||||
var secondsSpan = clock.querySelector('.seconds');
|
||||
|
||||
function updateClock() {
|
||||
var t = getTimeRemaining(endtime);
|
||||
|
||||
minutesSpan.innerHTML = ('0' + t.minutes).slice(-2);
|
||||
secondsSpan.innerHTML = ('0' + t.seconds).slice(-2);
|
||||
|
||||
if (t.total <= 0) {
|
||||
clearInterval(timeinterval);
|
||||
window.location = window.location.href;
|
||||
}
|
||||
}
|
||||
|
||||
updateClock();
|
||||
var timeinterval = setInterval(updateClock, 1000);
|
||||
}
|
||||
|
||||
function extractDomain(url) {
|
||||
var domain;
|
||||
//find & remove protocol (http, ftp, etc.) and get domain
|
||||
if (url.indexOf("://") > -1) {
|
||||
domain = url.split('/')[2];
|
||||
}
|
||||
else {
|
||||
domain = url.split('/')[0];
|
||||
}
|
||||
|
||||
//find & remove port number
|
||||
domain = domain.split(':')[0];
|
||||
|
||||
return domain;
|
||||
}
|
||||
|
||||
// if there's a cookie with the name myClock, use that value as the deadline
|
||||
var deadline = 0;
|
||||
if(document.cookie && document.cookie.match('myClock') && document.cookie.match(/(^|;)myClock=([^;]+)/)){
|
||||
// get deadline value from cookie
|
||||
var deadline = document.cookie.match(/(^|;)myClock=([^;]+)/)[2];
|
||||
var t = getTimeRemaining(deadline);
|
||||
if (t.total <= 0) {
|
||||
deadline = 0;
|
||||
}
|
||||
}
|
||||
|
||||
// otherwise, set a deadline 10 minutes from now and
|
||||
// save it in a cookie with that name
|
||||
if(deadline == 0){
|
||||
// create deadline 10 minutes from now
|
||||
var timeInMinutes = 15;
|
||||
var currentTime = Date.parse(new Date());
|
||||
var deadline = new Date(currentTime + timeInMinutes*60*1000);
|
||||
|
||||
// store deadline in cookie for future reference
|
||||
document.cookie = 'myClock=' + deadline + '; path=/; domain=' + extractDomain(window.location.href) + '; expires=' + deadline;
|
||||
}
|
||||
|
||||
initializeClock('clockdiv', deadline);
|
||||
//]]>
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
BIN
var/www/maintenance/maintenance.jpg
Normal file
BIN
var/www/maintenance/maintenance.jpg
Normal file
Binary file not shown.
After Width: | Height: | Size: 134 KiB |
80
var/www/maintenance/timeout.html
Normal file
80
var/www/maintenance/timeout.html
Normal file
@ -0,0 +1,80 @@
|
||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
|
||||
"http://www.w3.org/TR/html4/loose.dtd">
|
||||
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-type" content="text/html;charset=UTF-8">
|
||||
<title>Server Timeout</title>
|
||||
<style type="text/css">
|
||||
body{ text-align: center; padding-top: 50px; padding-left: 80px; font-family: sans-serif; font-weight: 100; font: 20px Helvetica, sans-serif; color: black; }
|
||||
h1{ font-size: 50px; font-weight: 100; font-size: 40px; margin: 40px 0px 20px; }
|
||||
#article{ display: block; text-align: left; margin: auto; }
|
||||
a{ color: #dc8100; text-decoration: none; }
|
||||
a:hover{ color: #333; text-decoration: none; }
|
||||
#clockdiv{ font-family: sans-serif; color: #fff; display: inline-block; font-weight: 100; text-align: center; font-size: 30px; }
|
||||
#clockdiv > div{ padding: 10px; border-radius: 3px; background: #00BF96; display: inline-block; }
|
||||
#clockdiv div > span{ padding: 15px; border-radius: 3px; background: #00816A; display: inline-block; }
|
||||
.smalltext{ padding-top: 5px; font-size: 16px; }
|
||||
</style>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div id="article">
|
||||
<h1>The remote server is not responding?</h1>
|
||||
<img src="/timeout.jpg" />
|
||||
<div>
|
||||
<p>Sorry for the inconvenience but the remote server is not responding.</p>
|
||||
<p>We'll try again in 2 minutes, but if it still isnt responding, please let us know.</p>
|
||||
<div id="clockdiv">
|
||||
<div>
|
||||
<span class="minutes"></span>
|
||||
<div class="smalltext">Minutes</div>
|
||||
</div>
|
||||
<div>
|
||||
<span class="seconds"></span>
|
||||
<div class="smalltext">Seconds</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script type="text/javascript">
|
||||
//<![CDATA[
|
||||
function getTimeRemaining(endtime) {
|
||||
var t = Date.parse(endtime) - Date.parse(new Date());
|
||||
var seconds = Math.floor((t / 1000) % 60);
|
||||
var minutes = Math.floor((t / 1000 / 60) % 60);
|
||||
return {
|
||||
'total': t,
|
||||
'minutes': minutes,
|
||||
'seconds': seconds
|
||||
};
|
||||
}
|
||||
|
||||
function initializeClock(id, endtime) {
|
||||
var clock = document.getElementById(id);
|
||||
var minutesSpan = clock.querySelector('.minutes');
|
||||
var secondsSpan = clock.querySelector('.seconds');
|
||||
|
||||
function updateClock() {
|
||||
var t = getTimeRemaining(endtime);
|
||||
|
||||
minutesSpan.innerHTML = ('0' + t.minutes).slice(-2);
|
||||
secondsSpan.innerHTML = ('0' + t.seconds).slice(-2);
|
||||
|
||||
if (t.total <= 0) {
|
||||
clearInterval(timeinterval);
|
||||
window.location = window.location.href;
|
||||
}
|
||||
}
|
||||
|
||||
updateClock();
|
||||
var timeinterval = setInterval(updateClock, 1000);
|
||||
}
|
||||
|
||||
var deadline = new Date(Date.parse(new Date()) + 2 * 60 * 1000);
|
||||
initializeClock('clockdiv', deadline);
|
||||
//]]>
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
BIN
var/www/maintenance/timeout.jpg
Normal file
BIN
var/www/maintenance/timeout.jpg
Normal file
Binary file not shown.
After Width: | Height: | Size: 118 KiB |
Loading…
Reference in New Issue
Block a user