Nginx user error configuration referencing line and file

I understand that I can set the file for the user error page:

location / { error_page 404 = /mybad.html; } 

But I would just like my page to be redefined as text inside the configuration file:

  location / { error_page 404 = "<H1>Sorry!</H1>" } 

Is this possible with nginx?

+4
source share
1 answer
 location / { error_page 404 @sorry; } location @sorry { return 404 "<H1>Sorry!</H1>"; } 
+8
source

All Articles