Created
September 22, 2016 12:22
-
-
Save tjunussov/51386315e9d588a3fc3d6656d94b876b to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Конфигурация NGINX | |
root /var/nginx/www/my.kazpost.kz; | |
location / { | |
try_files /500.html @conf; | |
} | |
location @conf { | |
proxy_redirect off; | |
proxy_set_header X-Real-IP $remote_addr; | |
proxy_set_header X-Forwarded-Host $host; | |
proxy_set_header X-Forwarded-Server $host; | |
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; | |
proxy_set_header Authorization ""; | |
proxy_pass http://172.30.75.41:8090; | |
} | |
location ~^/(on|off) { | |
try_files $uri /onoff.php; | |
fastcgi_pass 127.0.0.1:9000; | |
fastcgi_index onoff.php; | |
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; | |
include fastcgi_params; | |
} | |
Конфигурация permissions файловой системы | |
chmod 777 my.kazpost.kz | |
chown nginx:nginx my.kazpost.kz | |
Страница 50.html | |
Она должна лежать в папке root /var/nginx/www/my.kazpost.kz/50.html; | |
<html> | |
<title>500 Internal Server Error - АО Казпочта</title> | |
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"> | |
<link href='http://fonts.googleapis.com/css?family=Open+Sans:400,700&subset=cyrillic' rel='stylesheet' type='text/css'> | |
<style> | |
body { | |
color: #707070; | |
font-size: 14px; | |
font-family:'Open Sans'; | |
background: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAQgAAAAYCAYAAAAGV2PQAAAGFklEQVR42u1cv4/dRBC2iBQEDXGHhGhcITrkNqX/AUDuqYyEKOjchs41DXoNDUUkN4mUuxRYQkKi4nwFR4Eo3CDRWiAqCmJ2xfoybzK7O2O/9/wSzSetdGfvemZ9nm/nx+4liUKhUCgUC$ | |
url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAWMAAAA4CAMAAAAfImlTAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAyFpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkI$ | |
} | |
h1 { | |
color: #333; | |
font-family:'Open Sans'; | |
font-size: 20px; | |
font-weight: normal; | |
line-height: 1.5; | |
border-bottom: 1px solid #cccccc; | |
color: #333333; | |
padding-bottom: 10px; | |
margin-bottom: 20px; | |
} | |
.panel { | |
border: 1px solid #cccccc; | |
border-radius: 5px; | |
margin: 91px auto 0 auto; | |
height: 550px; | |
width: 520px; | |
padding:8px 20px; | |
background: url('data:image/jpg;base64,/9j/4QAYRXhpZgAASUkqAAgAAAAAAAAAAAAAAP/sABFEdWNreQABAAQAAAAyAAD/4QMqaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wLwA8P3hwYWNrZXQgYmVnaW49Iu+7vyIgaWQ9Ilc1TTBNcENlaGlIenJlU3pOVGN6a2M5ZCI/PiA8eDp4bXBtZ$ | |
} | |
.error { | |
border-color: #d04437; | |
color: #fff; | |
border-radius: 5px; | |
margin: 10px 0 0 0; | |
padding: 10px 10px 10px 36px; | |
line-height: 1.42857142857143; | |
background:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAzUlEQVR42q2T3QqCQBBGvcqCehETvVBfM71QsGeJ3kIyeo260DC2b+CThoVdsFo44JzdGfZnDIwxNhE4gB4M5EIX2et1sAI1eBnH4FwLNnOeTj6phUdQgDUp6OZxlhxdoOHEDaSAnuMT78G$ | |
} | |
</style> | |
<body> | |
<div class="panel"> | |
<h1>500 : Ошибка! У нас проблема.</h1> | |
<div class="error"> | |
<b>Сервер в данный момент недоступен!</b> <br> | |
Пожалуйста зайдите чуть позднее. <br> | |
Подробная информациия по тел: <b>0777</b> или <b>[email protected]</b> | |
</div> | |
</div> | |
<div style="position:absolute; bottom:20px; left:50%; margin-left:-170px; font-family:sans-serif; font-size:11px;">© 2014 Copyright. АО Казпочта. Департамент Информационных Технологий</div> | |
</body> | |
</html> | |
Переименователь файла OnOff.php | |
Он должен лежать в папке root /var/nginx/www/my.kazpost.kz/onoff.php; | |
<pre> | |
<?php | |
if(preg_match("/on/i",$_SERVER['REQUEST_URI'])){ | |
if(rename("50.html", "500.html")) echo "Maintenance mode on sucess"; | |
else echo "Maintenance mode already on"; | |
} else { | |
if(rename("500.html", "50.html")) echo "Maintenance mode off sucess"; | |
else echo "Maintenance mode already off"; | |
} | |
?> | |
</pre> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment