Add option for custom error pages (#276)

This commit is contained in:
Emile Broeders 2020-07-01 12:22:37 +02:00 committed by GitHub
parent c1b707cc5b
commit 63325aac0b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 9 additions and 0 deletions

View File

@ -77,6 +77,7 @@ nginx_http_template:
opts: [] # Listen opts like http2 which will be added (ssl is automatically added if you specify 'ssl:'). opts: [] # Listen opts like http2 which will be added (ssl is automatically added if you specify 'ssl:').
server_name: localhost server_name: localhost
include_files: [] include_files: []
http_error_pages: {}
error_page: /usr/share/nginx/html error_page: /usr/share/nginx/html
access_log: access_log:
- name: main - name: main

View File

@ -77,6 +77,8 @@
opts: opts:
- default_server - default_server
server_name: localhost server_name: localhost
http_error_pages:
404: /404.html
error_page: /usr/share/nginx/html error_page: /usr/share/nginx/html
client_max_body_size: 512k client_max_body_size: 512k
proxy_hide_headers: proxy_hide_headers:

View File

@ -475,6 +475,12 @@ server {
} }
{% endfor %} {% endfor %}
{% endif %} {% endif %}
{% if item.value.servers[server].http_error_pages is defined %}
# redirect server error pages
{% for error_code in item.value.servers[server].http_error_pages %}
error_page {{ error_code }} {{ item.value.servers[server].http_error_pages[error_code] }};
{% endfor %}
{% endif %}
{% if item.value.servers[server].error_page is defined %} {% if item.value.servers[server].error_page is defined %}
# redirect server error pages to the static page /50x.html # redirect server error pages to the static page /50x.html
# #