diff --git a/plugins/nginx-vhosts/install b/plugins/nginx-vhosts/install index 8b4d53217..0254b02f4 100755 --- a/plugins/nginx-vhosts/install +++ b/plugins/nginx-vhosts/install @@ -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 diff --git a/plugins/nginx-vhosts/templates/400-error.html b/plugins/nginx-vhosts/templates/400-error.html new file mode 100644 index 000000000..223aa802b --- /dev/null +++ b/plugins/nginx-vhosts/templates/400-error.html @@ -0,0 +1,9 @@ + + +
+
+

THERE HAS BEEN AN ERROR.

+
+
+ +'; diff --git a/plugins/nginx-vhosts/templates/404-error.html b/plugins/nginx-vhosts/templates/404-error.html new file mode 100644 index 000000000..474df07fd --- /dev/null +++ b/plugins/nginx-vhosts/templates/404-error.html @@ -0,0 +1,9 @@ + + +
+
+

404. NOT FOUND.

+
+
+ +'; diff --git a/plugins/nginx-vhosts/templates/500-error.html b/plugins/nginx-vhosts/templates/500-error.html new file mode 100644 index 000000000..223aa802b --- /dev/null +++ b/plugins/nginx-vhosts/templates/500-error.html @@ -0,0 +1,9 @@ + + +
+
+

THERE HAS BEEN AN ERROR.

+
+
+ +'; diff --git a/plugins/nginx-vhosts/templates/nginx.conf.sigil b/plugins/nginx-vhosts/templates/nginx.conf.sigil index 903f4f58d..57e737370 100644 --- a/plugins/nginx-vhosts/templates/nginx.conf.sigil +++ b/plugins/nginx-vhosts/templates/nginx.conf.sigil @@ -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 '

THERE HAS BEEN AN ERROR.

'; + root /etc/nginx/dokku-errors; + internal; + } error_page 404 /404-error.html; location /404-error.html { - return 404 '

404. Page Not Found.

'; + 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 '

THERE HAS BEEN AN ERROR.

'; + 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 '

THERE HAS BEEN AN ERROR.

'; + root /etc/nginx/dokku-errors; + internal; + } error_page 404 /404-error.html; location /404-error.html { - return 404 '

404. Page Not Found.

'; + 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 '

THERE HAS BEEN AN ERROR.

'; + root /etc/nginx/dokku-errors; + internal; } - } {{ end }}{{ end }}