{"id":140,"date":"2025-10-30T21:46:19","date_gmt":"2025-10-30T13:46:19","guid":{"rendered":"https:\/\/luckyfish.app\/?p=140"},"modified":"2025-10-31T15:12:53","modified_gmt":"2025-10-31T07:12:53","slug":"apache2-error-page-%e8%a8%ad%e5%ae%9a","status":"publish","type":"post","link":"https:\/\/blog.luckyfish.app\/?p=140","title":{"rendered":"Apache2 Error Page \u8a2d\u5b9a"},"content":{"rendered":"\n<p class=\"has-text-color has-link-color wp-elements-90cba03a038b41aa4af9cfd5b86ee901\" style=\"color:#555555\">\u672c\u7bc7\u8981\u4f86\u8aaa\u8aaa Error Page \u7684\u90e8\u5206\uff0c\u4e5f\u4e0d\u6703\u5f88\u96e3\u3002<\/p>\n\n\n\n<p class=\"has-text-color has-link-color wp-elements-48d0168d96a4b77e788362271576d6dc\" style=\"color:#555555\">\u9996\u5148\u53ef\u4ee5\u5148\u5efa\u4e00\u500b\u8cc7\u6599\u593e\u4f86\u653e\u4f60\u7684 error page \u9801\u9762\uff0c\u50cf\u662f\u6211\u5c31\u653e\u5728 \/var\/www\/ \u5e95\u4e0b\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code has-white-color has-text-color has-background has-link-color wp-elements-e854870d4dfee593f6268747e02f25b9\" style=\"background-color:#555555\"><code>sudo mkdir -p \/var\/www\/errors<\/code><\/pre>\n\n\n\n<p class=\"has-text-color has-link-color wp-elements-bf31921ad2965dedd9dda9a0cbec0863\" style=\"color:#555555\">error \u9019\u500b\u8cc7\u6599\u593e\u5167\u5c31\u53ef\u4ee5\u653e\u4f60\u8981\u7684 error page \u4e86\uff0ce.g., 403.html\u3001404.html\u3001500.html \u7b49\u7b49\u3002\u8a18\u5f97\u4e5f\u8981\u6539\u6b0a\u9650\uff01<\/p>\n\n\n\n<pre class=\"wp-block-code has-white-color has-text-color has-background has-link-color wp-elements-0269b5da6ab772b3e3365ebafd3dff02\" style=\"background-color:#555555\"><code>sudo chown -R www-data:www-data errors\/<\/code><\/pre>\n\n\n\n<p class=\"has-text-color has-link-color wp-elements-c93c2140d15f8bf38237e6cefd4fe718\" style=\"color:#555555\">\u63a5\u4e0b\u4f86\u4f86\u5230 Apache2 \u8a2d\u5b9a\u6a94\u7684\u90e8\u5206\uff0c\u6a94\u6848\u4f4d\u65bc \/etc\/apache2\/conf-available \u7684 localized-error-pages.conf\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code has-white-color has-text-color has-background has-link-color wp-elements-ae2de2b366e83375733885070b23579d\" style=\"background-color:#555555\"><code>sudo vim \/etc\/apache2\/conf-available\/localized-error-pages.conf<\/code><\/pre>\n\n\n\n<p class=\"has-text-color has-link-color wp-elements-3b5f8cd602d3e8d9c1c890a8638db5b5\" style=\"color:#555555\">\u5f88\u591a\u70ba\u8a3b\u89e3\uff0c\u53ef\u4ee5\u5148\u4e0d\u53bb\u7406\u6703\u4e26\u65b0\u589e\u4ee5\u4e0b\u7bc4\u4f8b\uff0c\u5168\u57df\u932f\u8aa4\u9801\u6709\u4ec0\u9ebc\u65b0\u589e\u4ec0\u9ebc\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code has-white-color has-text-color has-background has-link-color wp-elements-5bd3b13dec910ff0c230880c2ede131d\" style=\"background-color:#555555\"><code># \u5168\u57df\u63d0\u4f9b\u4f60\u81ea\u8a02\u932f\u8aa4\u9801\u7684\u53ef\u516c\u958b\u8def\u5f91\nAlias \/errors\/ \"\/var\/www\/errors\/\"\n\n&lt;Directory \"\/var\/www\/errors\">\n    Options -Indexes\n    Require all granted\n&lt;\/Directory>\n\n# \u5168\u57df\u932f\u8aa4\u9801\nErrorDocument 403 \/errors\/403.html\nErrorDocument 404 \/errors\/404.html\nErrorDocument 500 \/errors\/500.html\nErrorDocument 502 \/errors\/502.html\nErrorDocument 503 \/errors\/503.html<\/code><\/pre>\n\n\n\n<p class=\"has-text-color has-link-color wp-elements-a0c10919ddab30151961fddba046ee21\" style=\"color:#555555\">\u5176\u9918\u6c92\u8a2d\u5b9a error page \u53ef\u4ee5\u76f4\u63a5 \u4f7f\u7528 example\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code has-white-color has-text-color has-background has-link-color wp-elements-ba04a16f9a3f330303ee833984066f34\" style=\"background-color:#555555\"><code># Some examples:\n#ErrorDocument 500 \"The server made a boo boo.\"\n#ErrorDocument 404 \/missing.html\n#ErrorDocument 404 \"\/cgi-bin\/missing_handler.pl\"\n#ErrorDocument 402 http:\/\/www.example.com\/subscription_info.html\nErrorDocument 400 \"400\"\nErrorDocument 401 \"401\"\nErrorDocument 501 \"501\"\nErrorDocument 504 \"504\"<\/code><\/pre>\n\n\n\n<p class=\"has-text-color has-link-color wp-elements-cb7f149a850b217db430473f7c4c1b56\" style=\"color:#555555\">\u5b8c\u6210\u5927\u6982\u6703\u50cf\u9019\u6a23<\/p>\n\n\n\n<pre class=\"wp-block-code has-white-color has-text-color has-background has-link-color wp-elements-8fe8d16545622e6c32188f564430fb14\" style=\"background-color:#555555\"><code># Some examples:\nErrorDocument 400 \"400\"\nErrorDocument 401 \"401\"\nErrorDocument 501 \"501\"\nErrorDocument 504 \"504\"\n# \u5168\u57df\u63d0\u4f9b\u4f60\u81ea\u8a02\u932f\u8aa4\u9801\u7684\u53ef\u516c\u958b\u8def\u5f91\nAlias \/errors\/ \"\/var\/www\/errors\/\"\n\n&lt;Directory \"\/var\/www\/errors\">\n    Options -Indexes\n    Require all granted\n&lt;\/Directory>\n\n# \u5168\u57df\u932f\u8aa4\u9801\nErrorDocument 403 \/errors\/403.html\nErrorDocument 404 \/errors\/404.html\nErrorDocument 500 \/errors\/500.html\nErrorDocument 502 \/errors\/502.html\nErrorDocument 503 \/errors\/503.html<\/code><\/pre>\n\n\n\n<p class=\"has-text-color has-link-color wp-elements-8bf5872ab0ec07c3078d5b37019c7570\" style=\"color:#555555\">\u50cf\u662f\u6211\u7684 <a href=\"http:\/\/dev.luckyfish.app\">dev.luckyfish.app<\/a> \u5c31\u6709\u8a2d\u5b9a 403 error page\u3002<\/p>\n\n\n\n<figure class=\"wp-block-image size-full is-resized\"><img loading=\"lazy\" decoding=\"async\" width=\"1670\" height=\"1204\" src=\"https:\/\/luckyfish.app\/wp-content\/uploads\/2025\/10\/Screenshot-2025-10-31-at-3.12.19-PM.png\" alt=\"\" class=\"wp-image-160\" style=\"width:700px\"\/><\/figure>\n","protected":false},"excerpt":{"rendered":"<p>\u672c\u7bc7\u8981\u4f86\u8aaa\u8aaa Error Page \u7684\u90e8\u5206\uff0c\u4e5f\u4e0d\u6703\u5f88\u96e3\u3002 \u9996\u5148\u53ef\u4ee5\u5148\u5efa\u4e00\u500b\u8cc7\u6599\u593e\u4f86\u653e\u4f60\u7684 error page [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[8,3],"tags":[6],"class_list":["post-140","post","type-post","status-publish","format-standard","hentry","category-linux","category-3","tag-6"],"_links":{"self":[{"href":"https:\/\/blog.luckyfish.app\/index.php?rest_route=\/wp\/v2\/posts\/140","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.luckyfish.app\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.luckyfish.app\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.luckyfish.app\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.luckyfish.app\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=140"}],"version-history":[{"count":5,"href":"https:\/\/blog.luckyfish.app\/index.php?rest_route=\/wp\/v2\/posts\/140\/revisions"}],"predecessor-version":[{"id":161,"href":"https:\/\/blog.luckyfish.app\/index.php?rest_route=\/wp\/v2\/posts\/140\/revisions\/161"}],"wp:attachment":[{"href":"https:\/\/blog.luckyfish.app\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=140"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.luckyfish.app\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=140"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.luckyfish.app\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=140"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}