add custom error template and default error page location
Some checks failed
continuous-integration/drone/push Build is failing
Some checks failed
continuous-integration/drone/push Build is failing
This commit is contained in:
parent
7a811cb268
commit
868585dc9a
@ -107,6 +107,19 @@ nginx_error_page: []
|
|||||||
# dest: /4xx.html
|
# dest: /4xx.html
|
||||||
# @end
|
# @end
|
||||||
|
|
||||||
|
# @var nginx_error_location: description: >
|
||||||
|
# Default error location. If set, the defined location will be automatically added once
|
||||||
|
# to every server block to handle custom error sites.
|
||||||
|
# @end
|
||||||
|
# @var nginx_error_location:default: $ "_unset_"
|
||||||
|
# @var nginx_error_location: example: >
|
||||||
|
# nginx_error_location:
|
||||||
|
# match: /
|
||||||
|
# root: /var/www/vhosts/default
|
||||||
|
# index: index.html
|
||||||
|
# custom_options:
|
||||||
|
# @end
|
||||||
|
|
||||||
nginx_vhosts_dir: /var/www/vhosts
|
nginx_vhosts_dir: /var/www/vhosts
|
||||||
|
|
||||||
nginx_vhosts_default:
|
nginx_vhosts_default:
|
||||||
@ -152,6 +165,7 @@ nginx_vhosts_default:
|
|||||||
# proxy_send_timeout: 3600s
|
# proxy_send_timeout: 3600s
|
||||||
# proxy_headers: []
|
# proxy_headers: []
|
||||||
# proxy_intercept_errors: "off"
|
# proxy_intercept_errors: "off"
|
||||||
|
# custom_options:
|
||||||
# custom_options:
|
# custom_options:
|
||||||
# - 'deny: all'
|
# - 'deny: all'
|
||||||
|
|
||||||
|
@ -76,6 +76,15 @@
|
|||||||
validate: /bin/bash -c 'nginx -t -c /dev/stdin <<< "events {worker_connections 10;} http { include %s; }"'
|
validate: /bin/bash -c 'nginx -t -c /dev/stdin <<< "events {worker_connections 10;} http { include %s; }"'
|
||||||
notify: __nginx_reload
|
notify: __nginx_reload
|
||||||
|
|
||||||
|
- name: Add custom error page template
|
||||||
|
template:
|
||||||
|
src: usr/share/nginx/html/error.html.j2
|
||||||
|
dest: usr/share/nginx/html/error.html
|
||||||
|
owner: root
|
||||||
|
group: root
|
||||||
|
mode: 0644
|
||||||
|
notify: __nginx_reload
|
||||||
|
|
||||||
- name: Set selinux booleans
|
- name: Set selinux booleans
|
||||||
seboolean:
|
seboolean:
|
||||||
name: "{{ item.name }}"
|
name: "{{ item.name }}"
|
||||||
|
@ -31,7 +31,7 @@ http {
|
|||||||
{% if nginx_error_page is defined and nginx_error_page | length > 0 %}
|
{% if nginx_error_page is defined and nginx_error_page | length > 0 %}
|
||||||
|
|
||||||
{% for error in nginx_error_page %}
|
{% for error in nginx_error_page %}
|
||||||
error_page {{ error.code }} {{ error.dest }};
|
error_page {{ error.code | join(" ") }} {{ error.dest }};
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
@ -90,5 +90,22 @@ server {
|
|||||||
|
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
{% if nginx_error_location is defined %}
|
||||||
|
location {{ nginx_error_location.match }} {
|
||||||
|
{% if nginx_error_location.root is defined and nginx_error_location.root %}
|
||||||
|
root {{ nginx_error_location.root }};
|
||||||
|
{% endif %}
|
||||||
|
{% if nginx_error_location.index is defined and nginx_error_location.index %}
|
||||||
|
index {{ nginx_error_location.index }};
|
||||||
|
|
||||||
|
{% endif %}
|
||||||
|
{% if nginx_error_location.custom_options is defined and nginx_error_location.custom_options %}
|
||||||
|
|
||||||
|
{% for inline_option in nginx_error_location.custom_options %}
|
||||||
|
{{ inline_option }};
|
||||||
|
{% endfor %}
|
||||||
|
{% endif %}
|
||||||
|
}
|
||||||
|
{% endif %}
|
||||||
}
|
}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
83
templates/usr/error.html.j2
Normal file
83
templates/usr/error.html.j2
Normal file
@ -0,0 +1,83 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="utf-8" />
|
||||||
|
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
|
||||||
|
<meta
|
||||||
|
name="viewport"
|
||||||
|
content="width=device-width, initial-scale=1, shrink-to-fit=no"
|
||||||
|
/>
|
||||||
|
<meta name="robots" content="noindex, nofollow" />
|
||||||
|
|
||||||
|
<title>Oops! You're lost.</title>
|
||||||
|
|
||||||
|
<style>
|
||||||
|
html,
|
||||||
|
body {
|
||||||
|
height: 100%;
|
||||||
|
min-height: 100%;
|
||||||
|
margin: 0;
|
||||||
|
padding: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
body {
|
||||||
|
cursor: default;
|
||||||
|
font-family: -apple-system, system-ui, BlinkMacSystemFont, "Segoe UI",
|
||||||
|
Roboto, "Helvetica Neue", Arial, sans-serif;
|
||||||
|
font-size: 0.875rem;
|
||||||
|
font-weight: normal;
|
||||||
|
line-height: 1.5;
|
||||||
|
color: #383e4b;
|
||||||
|
background-color: #f5f5f5;
|
||||||
|
}
|
||||||
|
|
||||||
|
h1 {
|
||||||
|
font-size: 4.5rem;
|
||||||
|
font-weight: 300;
|
||||||
|
line-height: 1.1;
|
||||||
|
float: left;
|
||||||
|
margin: 0 1.5rem;
|
||||||
|
}
|
||||||
|
h4 {
|
||||||
|
font-size: 1.5rem;
|
||||||
|
padding: 0.7rem 0 0 0;
|
||||||
|
margin: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
p {
|
||||||
|
font-weight: 500;
|
||||||
|
line-height: 1.1;
|
||||||
|
color: #9da0a8;
|
||||||
|
padding: 0;
|
||||||
|
margin: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.wrapper {
|
||||||
|
position: relative;
|
||||||
|
top: 50%;
|
||||||
|
-webkit-transform: translateY(-60%);
|
||||||
|
-ms-transform: translateY(-60%);
|
||||||
|
transform: translateY(-60%);
|
||||||
|
}
|
||||||
|
|
||||||
|
.container {
|
||||||
|
width: 550px;
|
||||||
|
margin: 0 auto;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<body>
|
||||||
|
<div class="wrapper">
|
||||||
|
<div class="container">
|
||||||
|
<h1>
|
||||||
|
<!--# echo var="status" default="" -->
|
||||||
|
</h1>
|
||||||
|
<h4>Oops! You're lost.</h4>
|
||||||
|
<p>
|
||||||
|
<!--# echo var="status_text" default="Something goes wrong" -->
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</body>
|
||||||
|
</html>
|
Loading…
Reference in New Issue
Block a user