mod_cgi.html.ko.euc-kr 16.3 KB
Newer Older
powelld's avatar
powelld committed
<?xml version="1.0" encoding="EUC-KR"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="ko" xml:lang="ko"><head>
<meta content="text/html; charset=EUC-KR" http-equiv="Content-Type" />
<!--
        XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
              This file is generated from xml source: DO NOT EDIT
        XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
      -->
<title>mod_cgi - Apache HTTP Server Version 2.4</title>
<link href="../style/css/manual.css" rel="stylesheet" media="all" type="text/css" title="Main stylesheet" />
<link href="../style/css/manual-loose-100pc.css" rel="alternate stylesheet" media="all" type="text/css" title="No Sidebar - Default font size" />
<link href="../style/css/manual-print.css" rel="stylesheet" media="print" type="text/css" /><link rel="stylesheet" type="text/css" href="../style/css/prettify.css" />
<script src="../style/scripts/prettify.min.js" type="text/javascript">
</script>

<link href="../images/favicon.ico" rel="shortcut icon" /></head>
<body>
<div id="page-header">
<p class="menu"><a href="../mod/">모듈</a> | <a href="../mod/directives.html">지시어들</a> | <a href="http://wiki.apache.org/httpd/FAQ">FAQ</a> | <a href="../glossary.html">용어</a> | <a href="../sitemap.html">사이트맵</a></p>
<p class="apache">Apache HTTP Server Version 2.4</p>
<img alt="" src="../images/feather.png" /></div>
<div class="up"><a href="./"><img title="&lt;-" alt="&lt;-" src="../images/left.gif" /></a></div>
<div id="path">
<a href="http://www.apache.org/">Apache</a> &gt; <a href="http://httpd.apache.org/">HTTP Server</a> &gt; <a href="http://httpd.apache.org/docs/">Documentation</a> &gt; <a href="../">Version 2.4</a> &gt; <a href="./">모듈</a></div>
<div id="page-content">
<div id="preamble"><h1>아파치 모듈 mod_cgi</h1>
<div class="toplang">
<p><span>가능한 언어: </span><a href="../en/mod/mod_cgi.html" hreflang="en" rel="alternate" title="English">&nbsp;en&nbsp;</a> |
<a href="../fr/mod/mod_cgi.html" hreflang="fr" rel="alternate" title="Fran&#231;ais">&nbsp;fr&nbsp;</a> |
<a href="../ja/mod/mod_cgi.html" hreflang="ja" rel="alternate" title="Japanese">&nbsp;ja&nbsp;</a> |
<a href="../ko/mod/mod_cgi.html" title="Korean">&nbsp;ko&nbsp;</a></p>
</div>
<div class="outofdate">이 문서는 최신판 번역이 아닙니다.
            최근에 변경된 내용은 영어 문서를 참고하세요.</div>
<table class="module"><tr><th><a href="module-dict.html#Description">설명:</a></th><td>CGI 스크립트 실행</td></tr>
<tr><th><a href="module-dict.html#Status">상태:</a></th><td>Base</td></tr>
<tr><th><a href="module-dict.html#ModuleIdentifier">모듈명:</a></th><td>cgi_module</td></tr>
<tr><th><a href="module-dict.html#SourceFile">소스파일:</a></th><td>mod_cgi.c</td></tr></table>
<h3>요약</h3>

    

    <p>서버는 mime type이 <code>application/x-httpd-cgi</code>이거나
    (아파치 1.1 이후) 핸들러가 <code>cgi-script</code>인 모든
    파일을 CGI 스크립트로 인식하여, 실행하고, 그 결과를 클라이언트에게
    보낸다. 파일이 <code class="directive"><a href="../mod/mod_mime.html#addtype">AddType</a></code>
    지시어로 지정한 확장자를 가지거나, <code class="directive"><a href="../mod/mod_alias.html#scriptalias">ScriptAlias</a></code> 디렉토리 안에
    있으면 CGI로 처리된다.</p>

    <p>서버는 CGI 스크립트를 부를때 <code>DOCUMENT_ROOT</code>라는
    환경변수를 추가한다. 이 변수는 <code class="directive"><a href="../mod/core.html#documentroot">DocumentRoot</a></code> 설정값을 가진다.</p>

    <p>아파치에서 CGI 스크립트를 사용하는 방법에 대한 소개는
    <a href="../howto/cgi.html">CGI로 동적 페이지 생성</a> 투토리얼을
    참고하라.</p>

    <p>유닉스에서 다중쓰레드 MPM을 사용한다면 이 모듈대신
    <code class="module"><a href="../mod/mod_cgid.html">mod_cgid</a></code> 모듈을 사용해야 한다. 사용자
    입장에서 이 두 모듈은 기본적으로 동일하다.</p>
</div>
<div id="quickview"><a href="https://www.apache.org/foundation/contributing.html" class="badge"><img src="https://www.apache.org/images/SupportApache-small.png" alt="Support Apache!" /></a><h3>주제</h3>
<ul id="topics">
<li><img alt="" src="../images/down.gif" /> <a href="#env">CGI 환경변수</a></li>
<li><img alt="" src="../images/down.gif" /> <a href="#cgi-debug">CGI 디버깅</a></li>
</ul><h3 class="directives">지시어들</h3>
<ul id="toc">
<li><img alt="" src="../images/down.gif" /> <a href="#scriptlog">ScriptLog</a></li>
<li><img alt="" src="../images/down.gif" /> <a href="#scriptlogbuffer">ScriptLogBuffer</a></li>
<li><img alt="" src="../images/down.gif" /> <a href="#scriptloglength">ScriptLogLength</a></li>
</ul>
<h3>Bugfix checklist</h3><ul class="seealso"><li><a href="https://www.apache.org/dist/httpd/CHANGES_2.4">httpd changelog</a></li><li><a href="https://bz.apache.org/bugzilla/buglist.cgi?bug_status=__open__&amp;list_id=144532&amp;product=Apache%20httpd-2&amp;query_format=specific&amp;order=changeddate%20DESC%2Cpriority%2Cbug_severity&amp;component=mod_cgi">Known issues</a></li><li><a href="https://bz.apache.org/bugzilla/enter_bug.cgi?product=Apache%20httpd-2&amp;component=mod_cgi">Report a bug</a></li></ul><h3>참고</h3>
<ul class="seealso">
<li><code class="directive"><a href="../mod/core.html#acceptpathinfo">AcceptPathInfo</a></code></li>
<li><code class="directive"><a href="../mod/core.html#options">Options</a></code></li>
<li><code class="directive"><a href="../mod/mod_alias.html#scriptalias">ScriptAlias</a></code></li>
<li><code class="directive"><a href="../mod/mod_mime.html#addhandler">AddHandler</a></code></li>
<li><a href="../suexec.html">다른 사용자 ID로 CGI 프로그램
실행하기</a></li>
<li><a href="http://hoohoo.ncsa.uiuc.edu/cgi/">CGI 표준</a></li>
<li><a href="#comments_section">Comments</a></li></ul></div>
<div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
<div class="section">
<h2><a name="env" id="env">CGI 환경변수</a></h2>
    <p>서버는 다음과 같은 방법으로 <a href="http://hoohoo.ncsa.uiuc.edu/cgi/">CGI 표준</a>이 설명하는
    CGI 환경변수를 설정한다:</p>

    <dl>
      <dt>PATH_INFO</dt>

      <dd>이 변수는 <code class="directive"><a href="../mod/core.html#acceptpathinfo">AcceptPathInfo</a></code> 지시어를 직접 <code>off</code>
      지정한 경우에만 설정한다. <code class="directive">AcceptPathInfo</code>가 없는 경우 서버는 기본적으로
      경로 정보가 있는 요청에 대해 404 NOT FOUND 오류를 내지만,
      <code class="module"><a href="../mod/mod_cgi.html">mod_cgi</a></code>는 경로 정보를 (URI에서 스크립트
      파일명 뒤에 나오는 <code>/more/path/info</code>) 받는다.
      <code class="directive">AcceptPathInfo</code> 지시어를 생략하면
      <code class="module"><a href="../mod/mod_cgi.html">mod_cgi</a></code> 요청에 대해서 <code class="directive"><a href="../mod/core.html#acceptpathinfo">AcceptPathInfo</a></code><code>On</code>으로
      설정한 것과 같다.</dd>

      <dt>REMOTE_HOST</dt>

      <dd>이 변수는 <code class="directive"><a href="../mod/core.html#hostnamelookups">HostnameLookups</a></code><code>on</code>이고 (기본값은
      off), 접속한 호스트 주소를 역DNS 검색하여 실제 호스트명을
      찾은 경우에만 설정한다.</dd>

      <dt>REMOTE_IDENT</dt>

      <dd>이 변수는 <code class="directive"><a href="../mod/core.html#identitycheck">IdentityCheck</a></code><code>on</code>이고, 접속한
      호스트가 ident 프로토콜을 지원하는 경우에만 설정한다.
      쉽게 이 값을 속일 수 있기때문에 이 변수의 내용을 믿으면
      안되고, 클라이언트와 서버 사이에 프록시가 있다면 변수
      내용이 완전히 무의미함을 주의하라.</dd>

      <dt>REMOTE_USER</dt>

      <dd>CGI 스크립트가 인증을 거쳐야하는 경우에만 설정한다.</dd>
    </dl>
</div><div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
<div class="section">
<h2><a name="cgi-debug" id="cgi-debug">CGI 디버깅</a></h2>
    <p>어디에서 잘못 실행되는지 스크립트의 출력을 (표준출력과
    표준오류) 볼 수 없기때문에 CGI 스크립트는 전통적으로 디버깅하기
    어려웠다. 아파치 1.2 이후에 추가된 지시어를 사용하면 발생한
    오류를 자세히 로그에 남길 수 있다.</p>

    <h3>CGI 로그파일 형식</h3>
      <p>CGI 오류로그는 정상적으로 실행하지 못한 CGI를 기록한다.
      오류가 발생한 CGI 스크립트는 로그에 여러 줄의 정보를 남긴다.
      첫번째 두 줄은 항상 아래와 같은 형식이다:</p>

      <div class="example"><p><code>
        %% [<var>시간</var>] <var>요청줄</var><br />
        %% <var>HTTP-상태</var> <var>CGI-스크립트-파일명</var>
      </code></p></div>

      <p>CGI 스크립트를 실행할 수 없는 오류인 경우 로그파일에
      추가로 두 줄을 더 기록한다:</p>

      <div class="example"><p><code>
        %%error<br />
        <var>오류문</var>
      </code></p></div>

      <p>스크립트가 (보통 스크립트의 버그때문에) 잘못된 헤더
      정보를 반환하는 경우, 다음 내용을 로그에 기록한다:</p>

      <div class="example"><p><code>
        %request<br />
        <var>받은 모든 HTTP 헤더</var><br />
        <var>(있다면) POST나 PUT 내용</var><br />
        %response<br />
        <var>CGI 스크립트 출력의 모든 헤더</var><br />
        %stdout<br />
        <var>CGI 표준출력</var><br />
        %stderr<br />
        <var>CGI 표준오류</var><br />
      </code></p></div>

      <p>(스크립트가 표준출력이나 표준오류에 아무 내용도 출력하지
      않았다면 %stdout과 %stderr 부분은 생략될 수 있다).</p>
    
</div>
<div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
<div class="directive-section"><h2><a name="ScriptLog" id="ScriptLog">ScriptLog</a> <a name="scriptlog" id="scriptlog">지시어</a></h2>
<table class="directive">
<tr><th><a href="directive-dict.html#Description">설명:</a></th><td>CGI 스크립트 오류로그파일의 위치</td></tr>
<tr><th><a href="directive-dict.html#Syntax">문법:</a></th><td><code>ScriptLog <var>file-path</var></code></td></tr>
<tr><th><a href="directive-dict.html#Context">사용장소:</a></th><td>주서버설정, 가상호스트</td></tr>
<tr><th><a href="directive-dict.html#Status">상태:</a></th><td>Base</td></tr>
<tr><th><a href="directive-dict.html#Module">모듈:</a></th><td><code class="module"><a href="../mod/mod_cgi.html">mod_cgi</a></code>, <code class="module"><a href="../mod/mod_cgid.html">mod_cgid</a></code></td></tr>
</table>
    <p><code class="directive">ScriptLog</code> 지시어는 CGI 스크립트
    오류로그파일을 지정한다. <code class="directive">ScriptLog</code>
    사용하지않으면 오류로그를 만들지 않는다. 사용하면 아규먼트로
    지정한 파일에 CGI 오류를 기록한다. 상대경로를 지정하면
    <code class="directive"><a href="../mod/core.html#serverroot">ServerRoot</a></code>에 상대경로로
    받아들인다.
    </p>

    <div class="example"><h3>예제</h3><p><code>
      ScriptLog logs/cgi_log
    </code></p></div>

    <p>자식 프로세스를 실행하는 사용자, <em></em> <code class="directive"><a href="../mod/mpm_common.html#user">User</a></code> 지시어로 지정한 사용자
    권한으로 로그를 연다. 그래서 그 사용자가 스크립트 로그가
    있는 디렉토리에 쓰기권한이 있던지, 직접 미리 파일을 만들어서
    그 사용자에게 쓰기권한을 줘야 한다. 스크립트 로그를 주 로그
    디렉토리에 둔다면 자식 프로세스를 실행하는 사용자에게 쓰기권한을
    주기위해 디렉토리 권한을 변경하지 <strong>마라</strong>.</p>

    <p>스크립트 로그는 CGI 스크립트를 작성할때 디버깅을 위한
    용도이지 서버를 실행하는 동안 계속 사용하기위함이 아님을
    주의하라. 속도와 효율성면에서 최적화가 안되있고, 설계한
    목적이외의 방법으로 사용하면 보안상 문제가 될 수 있다.</p>

</div>
<div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
<div class="directive-section"><h2><a name="ScriptLogBuffer" id="ScriptLogBuffer">ScriptLogBuffer</a> <a name="scriptlogbuffer" id="scriptlogbuffer">지시어</a></h2>
<table class="directive">
<tr><th><a href="directive-dict.html#Description">설명:</a></th><td>스크립트 로그에 기록할 PUT 혹은 POST 요청의 최대량</td></tr>
<tr><th><a href="directive-dict.html#Syntax">문법:</a></th><td><code>ScriptLogBuffer <var>bytes</var></code></td></tr>
<tr><th><a href="directive-dict.html#Default">기본값:</a></th><td><code>ScriptLogBuffer 1024</code></td></tr>
<tr><th><a href="directive-dict.html#Context">사용장소:</a></th><td>주서버설정, 가상호스트</td></tr>
<tr><th><a href="directive-dict.html#Status">상태:</a></th><td>Base</td></tr>
<tr><th><a href="directive-dict.html#Module">모듈:</a></th><td><code class="module"><a href="../mod/mod_cgi.html">mod_cgi</a></code>, <code class="module"><a href="../mod/mod_cgid.html">mod_cgid</a></code></td></tr>
</table>
    <p>큰 내용을 받아서 로그파일이 너무 빨리 커지는 현상을 막기위해
    파일에 기록할 PUT 혹은 POST 내용의 크기를 제한한다. 기본적으로
    1024 바이트까지 로그에 기록하지만, 이 지시어를 사용하여
    수정할 수 있다.</p>

</div>
<div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
<div class="directive-section"><h2><a name="ScriptLogLength" id="ScriptLogLength">ScriptLogLength</a> <a name="scriptloglength" id="scriptloglength">지시어</a></h2>
<table class="directive">
<tr><th><a href="directive-dict.html#Description">설명:</a></th><td>CGI 스크립트 로그파일의 크기 제한</td></tr>
<tr><th><a href="directive-dict.html#Syntax">문법:</a></th><td><code>ScriptLogLength <var>bytes</var></code></td></tr>
<tr><th><a href="directive-dict.html#Default">기본값:</a></th><td><code>ScriptLogLength 10385760</code></td></tr>
<tr><th><a href="directive-dict.html#Context">사용장소:</a></th><td>주서버설정, 가상호스트</td></tr>
<tr><th><a href="directive-dict.html#Status">상태:</a></th><td>Base</td></tr>
<tr><th><a href="directive-dict.html#Module">모듈:</a></th><td><code class="module"><a href="../mod/mod_cgi.html">mod_cgi</a></code>, <code class="module"><a href="../mod/mod_cgid.html">mod_cgid</a></code></td></tr>
</table>
    <p><code class="directive">ScriptLogLength</code>는 CGI 스크립트
    로그파일의 크기를 제한한다. CGI 오류가 발생할때마다 (모든
    요청 헤더, 모든 스크립트 출력 등) 많은 정보가 로그에
    기록되기때문에 파일이 매우 커질 수 있다. 파일이 무한히 커지는
    문제를 막기위해 이 지시어를 사용하여 CGI 로그파일의 최대
    파일크기를 설정한다. 파일의 크기가 설정한 값을 넘으면 더
    이상 정보를 기록하지않는다.</p>

</div>
</div>
<div class="bottomlang">
<p><span>가능한 언어: </span><a href="../en/mod/mod_cgi.html" hreflang="en" rel="alternate" title="English">&nbsp;en&nbsp;</a> |
<a href="../fr/mod/mod_cgi.html" hreflang="fr" rel="alternate" title="Fran&#231;ais">&nbsp;fr&nbsp;</a> |
<a href="../ja/mod/mod_cgi.html" hreflang="ja" rel="alternate" title="Japanese">&nbsp;ja&nbsp;</a> |
<a href="../ko/mod/mod_cgi.html" title="Korean">&nbsp;ko&nbsp;</a></p>
</div><div class="top"><a href="#page-header"><img src="../images/up.gif" alt="top" /></a></div><div class="section"><h2><a id="comments_section" name="comments_section">Comments</a></h2><div class="warning"><strong>Notice:</strong><br />This is not a Q&amp;A section. Comments placed here should be pointed towards suggestions on improving the documentation or server, and may be removed again by our moderators if they are either implemented or considered invalid/off-topic. Questions on how to manage the Apache HTTP Server should be directed at either our IRC channel, #httpd, on Freenode, or sent to our <a href="http://httpd.apache.org/lists.html">mailing lists</a>.</div>
<script type="text/javascript"><!--//--><![CDATA[//><!--
var comments_shortname = 'httpd';
var comments_identifier = 'http://httpd.apache.org/docs/2.4/mod/mod_cgi.html';
(function(w, d) {
    if (w.location.hostname.toLowerCase() == "httpd.apache.org") {
        d.write('<div id="comments_thread"><\/div>');
        var s = d.createElement('script');
        s.type = 'text/javascript';
        s.async = true;
        s.src = 'https://comments.apache.org/show_comments.lua?site=' + comments_shortname + '&page=' + comments_identifier;
        (d.getElementsByTagName('head')[0] || d.getElementsByTagName('body')[0]).appendChild(s);
    }
    else { 
        d.write('<div id="comments_thread">Comments are disabled for this page at the moment.<\/div>');
    }
})(window, document);
//--><!]]></script></div><div id="footer">
<p class="apache">Copyright 2017 The Apache Software Foundation.<br />Licensed under the <a href="http://www.apache.org/licenses/LICENSE-2.0">Apache License, Version 2.0</a>.</p>
<p class="menu"><a href="../mod/">모듈</a> | <a href="../mod/directives.html">지시어들</a> | <a href="http://wiki.apache.org/httpd/FAQ">FAQ</a> | <a href="../glossary.html">용어</a> | <a href="../sitemap.html">사이트맵</a></p></div><script type="text/javascript"><!--//--><![CDATA[//><!--
if (typeof(prettyPrint) !== 'undefined') {
    prettyPrint();
}
//--><!]]></script>
</body></html>