Switched to templated error pages
This commit is contained in:
@@ -52,6 +52,13 @@ chgrp -R adm /var/log/nginx
|
||||
gpasswd -M "" dokku
|
||||
[[ -f /etc/logrotate.d/nginx ]] && sed -i -e 's/create 0640 www-data dokku/create 0640 www-data adm/g' /etc/logrotate.d/nginx
|
||||
|
||||
# Create nginx error templates
|
||||
sudo mkdir -p /etc/nginx/dokku-errors
|
||||
sudo cp ./templates/400-error.html /etc/nginx/dokku-errors/400-error.html
|
||||
sudo cp ./templates/404-error.html /etc/nginx/dokku-errors/404-error.html
|
||||
sudo cp ./templates/500-error.html /etc/nginx/dokku-errors/500-error.html
|
||||
|
||||
|
||||
# patch broken nginx 1.8.0 logrotate
|
||||
[[ -f /etc/logrotate.d/nginx ]] && sed -i -e 's/invoke-rc.d/service/g' /etc/logrotate.d/nginx
|
||||
|
||||
|
||||
9
plugins/nginx-vhosts/templates/400-error.html
Normal file
9
plugins/nginx-vhosts/templates/400-error.html
Normal file
@@ -0,0 +1,9 @@
|
||||
<html>
|
||||
<body style="padding:0; margin: 0;">
|
||||
<div style="width:100%; height: 100%; text-align:center; font-family: arial; font-weight: bold; color: #ffffff; background: rgba(33, 129, 243, 0.66);">
|
||||
<div style="position:absolute; top: 50%; left: 50%; transform: translateX(-50%) translateY(-50%);">
|
||||
<h1>THERE HAS BEEN AN ERROR.</h1>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
</html>';
|
||||
9
plugins/nginx-vhosts/templates/404-error.html
Normal file
9
plugins/nginx-vhosts/templates/404-error.html
Normal file
@@ -0,0 +1,9 @@
|
||||
<html>
|
||||
<body style="padding:0; margin: 0;">
|
||||
<div style="width:100%; height: 100%; text-align:center; font-family: arial; font-weight: bold; color: #ffffff; background: rgba(33, 129, 243, 0.66);">
|
||||
<div style="position:absolute; top: 50%; left: 50%; transform: translateX(-50%) translateY(-50%);">
|
||||
<h1>404. NOT FOUND.</h1>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
</html>';
|
||||
9
plugins/nginx-vhosts/templates/500-error.html
Normal file
9
plugins/nginx-vhosts/templates/500-error.html
Normal file
@@ -0,0 +1,9 @@
|
||||
<html>
|
||||
<body style="padding:0; margin: 0;">
|
||||
<div style="width:100%; height: 100%; text-align:center; font-family: arial; font-weight: bold; color: #ffffff; background: rgba(33, 129, 243, 0.66);">
|
||||
<div style="position:absolute; top: 50%; left: 50%; transform: translateX(-50%) translateY(-50%);">
|
||||
<h1>THERE HAS BEEN AN ERROR.</h1>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
</html>';
|
||||
@@ -37,16 +37,20 @@ server {
|
||||
|
||||
error_page 400 401 402 403 405 406 407 408 409 410 411 412 413 414 415 416 417 418 420 422 423 424 426 428 429 431 444 449 450 451 /400-error.html;
|
||||
location /400-error.html {
|
||||
return 400 '<html><body style="padding:0; margin: 0;"><div style="width:100%; height: 100%; text-align:center; font-family: arial; font-weight: bold; color: #ffffff; background: rgba(33, 129, 243, 0.66);"> <div style="position:absolute; top: 50%; left: 50%; transform: translateX(-50%) translateY(-50%);"><h1>THERE HAS BEEN AN ERROR.</h1></div></div></body></html>';
|
||||
root /etc/nginx/dokku-errors;
|
||||
internal;
|
||||
}
|
||||
|
||||
error_page 404 /404-error.html;
|
||||
location /404-error.html {
|
||||
return 404 '<html><body style="padding:0; margin: 0;"><div style="width:100%; height: 100%; text-align:center; font-family: arial; font-weight: bold; color: #ffffff; background: rgba(33, 129, 243, 0.66);"> <div style="position:absolute; top: 50%; left: 50%; transform: translateX(-50%) translateY(-50%);"><h1>404. Page Not Found.</h1></div></div></body></html>';
|
||||
root /etc/nginx/dokku-errors;
|
||||
internal;
|
||||
}
|
||||
|
||||
error_page 500 501 502 503 504 505 506 507 508 509 510 511 /500-error.html;
|
||||
location /500-error.html {
|
||||
return 500 '<html><body style="padding:0; margin: 0;"><div style="width:100%; height: 100%; text-align:center; font-family: arial; font-weight: bold; color: #ffffff; background: rgba(33, 129, 243, 0.66);"> <div style="position:absolute; top: 50%; left: 50%; transform: translateX(-50%) translateY(-50%);"><h1>THERE HAS BEEN AN ERROR.</h1></div></div></body></html>';
|
||||
root /etc/nginx/dokku-errors;
|
||||
internal;
|
||||
}
|
||||
{{ end }}
|
||||
}
|
||||
@@ -87,21 +91,23 @@ server {
|
||||
}
|
||||
include {{ $.DOKKU_ROOT }}/{{ $.APP }}/nginx.conf.d/*.conf;
|
||||
|
||||
|
||||
error_page 400 401 402 403 405 406 407 408 409 410 411 412 413 414 415 416 417 418 420 422 423 424 426 428 429 431 444 449 450 451 /400-error.html;
|
||||
location /400-error.html {
|
||||
return 400 '<html><body style="padding:0; margin: 0;"><div style="width:100%; height: 100%; text-align:center; font-family: arial; font-weight: bold; color: #ffffff; background: rgba(33, 129, 243, 0.66);"> <div style="position:absolute; top: 50%; left: 50%; transform: translateX(-50%) translateY(-50%);"><h1>THERE HAS BEEN AN ERROR.</h1></div></div></body></html>';
|
||||
root /etc/nginx/dokku-errors;
|
||||
internal;
|
||||
}
|
||||
|
||||
error_page 404 /404-error.html;
|
||||
location /404-error.html {
|
||||
return 404 '<html><body style="padding:0; margin: 0;"><div style="width:100%; height: 100%; text-align:center; font-family: arial; font-weight: bold; color: #ffffff; background: rgba(33, 129, 243, 0.66);"> <div style="position:absolute; top: 50%; left: 50%; transform: translateX(-50%) translateY(-50%);"><h1>404. Page Not Found.</h1></div></div></body></html>';
|
||||
root /etc/nginx/dokku-errors;
|
||||
internal;
|
||||
}
|
||||
|
||||
error_page 500 501 502 503 504 505 506 507 508 509 510 511 /500-error.html;
|
||||
location /500-error.html {
|
||||
return 500 '<html><body style="padding:0; margin: 0;"><div style="width:100%; height: 100%; text-align:center; font-family: arial; font-weight: bold; color: #ffffff; background: rgba(33, 129, 243, 0.66);"> <div style="position:absolute; top: 50%; left: 50%; transform: translateX(-50%) translateY(-50%);"><h1>THERE HAS BEEN AN ERROR.</h1></div></div></body></html>';
|
||||
root /etc/nginx/dokku-errors;
|
||||
internal;
|
||||
}
|
||||
|
||||
}
|
||||
{{ end }}{{ end }}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user