mirror of
https://github.com/bunkerity/bunkerized-nginx
synced 2023-12-13 21:30:18 +01:00
misc - default pages for default server
This commit is contained in:
parent
99b85ec8a9
commit
29b3731487
3 changed files with 114 additions and 0 deletions
32
src/common/core/misc/confs/default-server-http/errors.conf
Normal file
32
src/common/core/misc/confs/default-server-http/errors.conf
Normal file
|
@ -0,0 +1,32 @@
|
|||
{% set default_errors = ["400", "401", "403", "404", "405", "413", "429", "500", "501", "502", "503", "504"] %}
|
||||
|
||||
{% for default_error in default_errors %}
|
||||
{% if not default_error + "=" in ERRORS +%}
|
||||
{% if default_error == "405" +%}
|
||||
error_page 405 =200 @405;
|
||||
{% else +%}
|
||||
error_page {{ default_error }} @{{ default_error }};
|
||||
{% endif +%}
|
||||
location @{{ default_error }} {
|
||||
auth_basic off;
|
||||
internal;
|
||||
modsecurity off;
|
||||
default_type 'text/html';
|
||||
content_by_lua_block {
|
||||
local logger = require "logger"
|
||||
local errors = require "errors.errors"
|
||||
local html, err
|
||||
if ngx.status == 200 then
|
||||
html, err = errors.error_html(tostring(405))
|
||||
else
|
||||
html, err = errors.error_html(tostring(ngx.status))
|
||||
end
|
||||
if not html then
|
||||
logger.log(ngx.ERR, "ERRORS", "Error while computing HTML error template for {{ default_error }} : " .. err)
|
||||
else
|
||||
ngx.say(html)
|
||||
end
|
||||
}
|
||||
}
|
||||
{% endif %}
|
||||
{% endfor %}
|
0
src/common/core/misc/confs/default-server-http/page.conf
Normal file
0
src/common/core/misc/confs/default-server-http/page.conf
Normal file
82
src/common/core/misc/files/default.html
Normal file
82
src/common/core/misc/files/default.html
Normal file
File diff suppressed because one or more lines are too long
Loading…
Reference in a new issue