'Let nginx handle 404 pages instead of wordpress 404 page to reduce server load

I'm quite new to WordPress and nginx. How do I let nginx handle 404 pages instead of WordPress?

I tried putting these codes into the server block but it still

error_page 404 /404.html;
location  /404.html {
  internal;
}


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source