add error_page related options
continuous-integration/drone/push Build is failing Details

This commit is contained in:
Robert Kaussow 2020-05-25 10:15:42 +02:00
parent c99f44aca7
commit 0f6582f3aa
3 changed files with 27 additions and 6 deletions

View File

@ -98,6 +98,15 @@ nginx_maps: []
# - "/old/path /new_path"
# @end
nginx_error_page: []
# @var nginx_error_page:example:
# nginx_error_page:
# - code:
# - 404
# - 403
# dest: /4xx.html
# @end
nginx_vhosts_dir: /var/www/vhosts
nginx_vhosts_default:
@ -109,6 +118,10 @@ nginx_vhosts_default:
- match: /
root: /var/www/vhosts/default
index: index.html
- match: /50x.html
root: "/usr/share/nginx/html"
custom_options:
- "error_page 500 502 503 504 /50x.html"
# @var nginx_vhosts_default:example: >
# nginx_vhosts_default:
@ -141,7 +154,7 @@ nginx_vhosts_default:
# proxy_intercept_errors: "off"
# custom_options:
# - 'deny: all'
# error_page: /usr/share/nginx/html
nginx_vhosts_extra: []

View File

@ -28,7 +28,13 @@ http {
{% else %}
access_log off;
{% endif %}
{% if nginx_error_page is defined and nginx_error_page | len > 0 %}
{% for error in nginx_error_page %}
error_page {{ error.code }} {{ error.dest }};
{% endfor %}
{% endif %}
map $http_upgrade $connection_upgrade {
default upgrade;
'' close;

View File

@ -37,6 +37,13 @@ server {
{% if server.send_timeout is defined and server.send_timeout %}
send_timeout {{ server.send_timeout }};
{% endif %}
{% if server.custom_options is defined and server.custom_options %}
{% for inline_option in server.custom_options %}
{{ inline_option }};
{% endfor %}
{% endif %}
{% for location in server.locations %}
location {{ location.match }} {
{% if location.root is defined and location.root %}
@ -82,11 +89,6 @@ server {
}
{% endfor %}
# redirect server error pages to the static page /50x.html
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root {{ item.error_page | default("/usr/share/nginx/html") }};
}
{% endif %}
}
{% endfor %}