nginx custom error configuration referencing a string vs a file
nginx
Solution
location / {
error_page 404 @sorry;
}
location @sorry {
return 404 "<H1>Sorry!</H1>";
}
- http://nginx.org/r/error_page
- http://nginx.org/r/return
Problem
I understand that I can set a file for a custom error page: ``` location / { error_page 404 = /mybad.html; } ``` But I'd just like to instead provide my page override as text inline in the config file: ``` location / { error_page 404 = "<H1>Sorry!</H1>" } ``` Is this possible with nginx?