back to top

Apache 웹서버 오류 페이지 지정 방법

작성일 :

Apache 웹서버 설정을 변경해 투박한 기본 오류 페이지가 아닌 나만의 개성 넘치는 오류 페이지를 보여줄 수 있기 때문에 사용자가 어떤 오류가 발생했는지 솝쉽게 확인할 수 있습니다. 참고로, Internet Explorer는 오류 페이지가 512바이트 이하인 경우 기본 오류 페이지를 표시하기 때문에 최소 용량 이상으로 오류 페이지를 만드시기 바랍니다.

404 페이지 예시

Apache 웹서버 오류 페이지 지정 기능을 사용하면 단순한 오류 메시지만 표시하는 기본 오류 페이지와 달리 개성 넘치는 오류 페이지를 표시할 수 있습니다. 다양한 오류 페이지를 보고 싶으시다면 구글에 404 Error Page를 검색(새창)해보시기 바랍니다.

다양한 오류 메시지

Informational 1xx
100 => 'Continue',
101 => 'Switching Protocols',

• Success 2xx
200 => 'OK',
201 => 'Created',
202 => 'Accepted',
203 => 'Non-Authoritative Information',
204 => 'No Content',
205 => 'Reset Content',
206 => 'Partial Content',

• Redirection 3xx
300 => 'Multiple Choices',
301 => 'Moved Permanently',
302 => 'Found',  // 1.1
303 => 'See Other',
304 => 'Not Modified',
305 => 'Use Proxy',
// 306 is deprecated but reserved
307 => 'Temporary Redirect',

• Client Error 4xx
400 => 'Bad Request',
401 => 'Unauthorized',
402 => 'Payment Required',
403 => 'Forbidden',
404 => 'Not Found',
405 => 'Method Not Allowed',
406 => 'Not Acceptable',
407 => 'Proxy Authentication Required',
408 => 'Request Timeout',
409 => 'Conflict',
410 => 'Gone',
411 => 'Length Required',
412 => 'Precondition Failed',
413 => 'Request Entity Too Large',
414 => 'Request-URI Too Long',
415 => 'Unsupported Media Type',
416 => 'Requested Range Not Satisfiable',
417 => 'Expectation Failed',

• Server Error 5xx
500 => 'Internal Server Error',
501 => 'Not Implemented',
502 => 'Bad Gateway',
503 => 'Service Unavailable',
504 => 'Gateway Timeout',
505 => 'HTTP Version Not Supported',
509 => 'Bandwidth Limit Exceeded'

오류 메시지의 종류는 정말 다양하지만 모든 페이지를 만들고 관리하는 것은 매우 어려운 일이기 때문에 주로 발생하는 403, 404, 500, 503 오류 페이지만 별도의 오류 페이지를 표시하게 설정해도 괜찮다고 생각됩니다.

오류 페이지 지정 방법

#1. 서버 내 모든 사이트가 통합된 오류 페이지 표시하도록 설정하기

ErrorDocument 503 "error.jnhost.co.cc/503.php"
ErrorDocument 500 "error.jnhost.co.cc/500.php"
ErrorDocument 404 "error.jnhost.co.cc/404.php"
ErrorDocument 403 "error.jnhost.co.cc/403.php”

Apache 웹서버의 httpd.conf를 메모장으로 열고 ErrorDocument를 검색해 주석(#)을 삭제한 후 적절한 오류 코드와 주소로 변경해 사용하면 됩니다. 해당 값을 추가한 후에는 반드시 Apache 웹서버를 재시작해야 합니다.

#2. 가상 호스트마다 다른 오류 페이지 표시하도록 설정하기

<VirtualHost *:80>
ServerName jnstory.net
ServerAlias www.jnstory.net
DocumentRoot E:/www/my/jnstory
ErrorDocument 404 "error.jnhost.co.cc/404.php
</VirtualHost>

Apache 웹서버의 httpd-vhost.conf를 메모장으로 열고 가상 호스트 마지막 부분에 빨간색으로 표시한 부분을 복사 → 붙여넣기 합니다.

관련 글 읽기

의견

의견을 남겨주세요.

Please enter your comment!
Please enter your name here

최근 작성 글