{"id":1016,"date":"2017-04-07T10:23:54","date_gmt":"2017-04-07T09:23:54","guid":{"rendered":"http:\/\/www.haxed.me.uk\/?p=1016"},"modified":"2017-04-07T10:23:54","modified_gmt":"2017-04-07T09:23:54","slug":"setting-404-error-page-nginx","status":"publish","type":"post","link":"https:\/\/haxed.me.uk\/index.php\/2017\/04\/07\/setting-404-error-page-nginx\/","title":{"rendered":"Setting 404 Error page in nginx"},"content":{"rendered":"<p>It&#8217;s easy to setup an custom error page in nginx. Just create a file in your documentroot like \/404.html so if your documentroot is \/var\/www\/html create a file called 404.html, then go into your \/etc\/nginx\/nginx.conf, or \/etc\/nginx\/conf.d\/mysite.conf, and add this in your configuration between server { } directive.<\/p>\n<p>Remember if your running https and http you will need the directive for each of them.<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\nerror_page 404 \/404.html;\r\n<\/pre>\n<p>It&#8217;s possible to define a really custom location securely;<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\n\r\n        error_page 404 \/cust_404.html;\r\n        location = \/cust_404.html {\r\n                root \/usr\/share\/nginx\/html;\r\n                internal;\r\n        }\r\n\r\n\r\n<\/pre>\n<p>Just make sure you don&#8217;t have a filename called 404.html in \/404.html as I&#8217;m not sure this would work otherwise.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>It&#8217;s easy to setup an custom error page in nginx. Just create a file in your documentroot like \/404.html so if your documentroot is \/var\/www\/html create a file called 404.html, then go into your \/etc\/nginx\/nginx.conf, or \/etc\/nginx\/conf.d\/mysite.conf, and add this &hellip; <a href=\"https:\/\/haxed.me.uk\/index.php\/2017\/04\/07\/setting-404-error-page-nginx\/\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[91,61,20],"tags":[],"class_list":["post-1016","post","type-post","status-publish","format-standard","hentry","category-nginx","category-rackspace","category-webhosting"],"_links":{"self":[{"href":"https:\/\/haxed.me.uk\/index.php\/wp-json\/wp\/v2\/posts\/1016","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/haxed.me.uk\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/haxed.me.uk\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/haxed.me.uk\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/haxed.me.uk\/index.php\/wp-json\/wp\/v2\/comments?post=1016"}],"version-history":[{"count":1,"href":"https:\/\/haxed.me.uk\/index.php\/wp-json\/wp\/v2\/posts\/1016\/revisions"}],"predecessor-version":[{"id":1017,"href":"https:\/\/haxed.me.uk\/index.php\/wp-json\/wp\/v2\/posts\/1016\/revisions\/1017"}],"wp:attachment":[{"href":"https:\/\/haxed.me.uk\/index.php\/wp-json\/wp\/v2\/media?parent=1016"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/haxed.me.uk\/index.php\/wp-json\/wp\/v2\/categories?post=1016"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/haxed.me.uk\/index.php\/wp-json\/wp\/v2\/tags?post=1016"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}