name-based.html.ko.euc-kr 17.6 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>이름기반 가상호스트 지원 - 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 id="manual-page"><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>이름기반 가상호스트 지원</h1>
<div class="toplang">
<p><span>가능한 언어: </span><a href="../de/vhosts/name-based.html" hreflang="de" rel="alternate" title="Deutsch">&nbsp;de&nbsp;</a> |
<a href="../en/vhosts/name-based.html" hreflang="en" rel="alternate" title="English">&nbsp;en&nbsp;</a> |
<a href="../fr/vhosts/name-based.html" hreflang="fr" rel="alternate" title="Fran&#231;ais">&nbsp;fr&nbsp;</a> |
<a href="../ja/vhosts/name-based.html" hreflang="ja" rel="alternate" title="Japanese">&nbsp;ja&nbsp;</a> |
<a href="../ko/vhosts/name-based.html" title="Korean">&nbsp;ko&nbsp;</a> |
<a href="../tr/vhosts/name-based.html" hreflang="tr" rel="alternate" title="T&#252;rk&#231;e">&nbsp;tr&nbsp;</a></p>
</div>
<div class="outofdate">이 문서는 최신판 번역이 아닙니다.
            최근에 변경된 내용은 영어 문서를 참고하세요.</div>

    <p>이 문서는 이름기반 가상호스트를 사용하는 경우와 방법을
    설명한다.</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><ul id="toc"><li><img alt="" src="../images/down.gif" /> <a href="#namevip">이름기반 대 IP기반 가상호스트</a></li>
<li><img alt="" src="../images/down.gif" /> <a href="#using">이름기반 가상호스트 사용하기</a></li>
<li><img alt="" src="../images/down.gif" /> <a href="#compat">오래된 브라우저와 호환</a></li>
</ul><h3>참고</h3><ul class="seealso"><li><a href="ip-based.html">IP기반 가상호스트 지원</a></li><li><a href="details.html">가상호스트 찾기에 대한 자세한 설명</a></li><li><a href="mass.html">대량의 가상호스트를 동적으로 설정하기</a></li><li><a href="examples.html">일반적인 가상호스트 예</a></li><li><a href="examples.html#serverpath">ServerPath 설정 예</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="namevip" id="namevip">이름기반 대 IP기반 가상호스트</a></h2>

    <p>IP기반 가상호스트는 연결한 IP 주소를 가지고 서비스할
    가상호스트를 결정한다. 그래서 각 호스트는 서로 다른 IP 주소를
    가져야 한다. 이름기반 가상호스트의 경우 서버는 클라이언트가
    HTTP 헤더로 호스트명을 알려주길 바란다. 이런 방법으로 한
    IP 주소로 여러 다른 호스트를 서비스할 수 있다.</p>

    <p>이름기반 가상호스트는 DNS 서버가 각 호스트명이 올바른
    IP 주소로 대응하도록 가상호스트를 설정하고, 다른 호스트명을 구별할
    수 있도록 아파치 웹서버를 설정하기만 하면되므로 더 간단하다. 이름기반
    가상호스트는 또 여러 IP 주소가 필요없다. 그러므로 특별히
    IP기반 가상호스트를 선택할 이유가 없다면 이름기반 가상호스트를
    사용해야 한다. IP기반 가상호스트를 사용해야할 이유로는:</p>

	<ul>
        <li>이름기반 가상호스트를 지원하지않는 오래된
        클라이언트들이 있다. 이름기반 가상호스트를 사용하려면
        클라이언트가 HTTP Host 헤더를 보내야 한다. 이는
        HTTP/1.1에서는 필수이고, 최근 모든 HTTP/1.0 브라우저들도
        확장으로 지원한다. 만약 이름기반 가상호스트를 사용하면서
        오래된 클라이언트를 지원해야 한다면 이 문서 끝에 있는
        방법을 살펴봐라.</li>

        <li>SSL 프로토콜의 성격상 SSL 보안서버에서 이름기반
        가상호스트를 사용할 수 없다.</li>

        <li>어떤 운영체제나 네트웍 장치는 다른 IP 주소를 사용하지
        않으면 호스트를 구별하지 못하는 네트웍 사용량(bandwidth)
        관리기술을 사용한다.</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="using" id="using">이름기반 가상호스트 사용하기</a></h2>

<table class="related"><tr><th>관련된 모듈</th><th>관련된 지시어</th></tr><tr><td><ul><li><code class="module"><a href="../mod/core.html">core</a></code></li></ul></td><td><ul><li><code class="directive"><a href="../mod/core.html#documentroot">DocumentRoot</a></code></li><li><code class="directive"><a href="../mod/core.html#namevirtualhost">NameVirtualHost</a></code></li><li><code class="directive"><a href="../mod/core.html#serveralias">ServerAlias</a></code></li><li><code class="directive"><a href="../mod/core.html#servername">ServerName</a></code></li><li><code class="directive"><a href="../mod/core.html#serverpath">ServerPath</a></code></li><li><code class="directive"><a href="../mod/core.html#virtualhost">&lt;VirtualHost&gt;</a></code></li></ul></td></tr></table>

    <p>이름기반 가상호스트를 사용하려면 서버는 연결을 받을
    IP 주소를 (아마 포트도) 정해야 한다. 이는 <code class="directive"><a href="../mod/core.html#namevirtualhost">NameVirtualHost</a></code> 지시어로 가능하다.
    일반적으로 서버의 모든 IP 주소를 사용한다면
    <code class="directive"><a href="../mod/core.html#namevirtualhost">NameVirtualHost</a></code>
    아규먼트로 <code>*</code>를 사용한다. 여러 포트를 사용할
    (예를 들어, SSL을 사용할) 계획이라면 <code>*:80</code>
    같이 아규먼트에 포트를 추가해야 한다. <code class="directive"><a href="../mod/core.html#namevirtualhost">NameVirtualHost</a></code> 지시어에 IP 주소를
    적어주었다고 서버가 자동으로 그 IP 주소를 기다리지 않음을
    주의하라. 자세한 내용은 <a href="../bind.html">아파치가
    사용할 주소와 포트 설정하기</a>를 참고하라. 또, 여기서
    지정한 IP 주소는 서버의 네트웍 인터페이스이어야 한다.</p>

    <p>다음 단계는 서비스하려는 호스트별로 <code class="directive"><a href="../mod/core.html#virtualhost">&lt;VirtualHost&gt;</a></code> 블록을
    만드는 일이다. <code class="directive"><a href="../mod/core.html#virtualhost&gt;">&lt;VirtualHost&gt;&gt;</a></code> 지시어의 아규먼트는
    <code class="directive"><a href="../mod/core.html#namevirtualhost">NameVirtualHost</a></code> 지시어의
    아규먼트(예를 들어, IP 주소나 모든 주소를 뜻하는 <code>*</code>)와
    같아야 한다. <code class="directive"><a href="../mod/core.html#virtualhost&gt;">&lt;VirtualHost&gt;&gt;</a></code> 블록 안에는
    최소한 서비스할 호스트를 지정하는 <code class="directive"><a href="../mod/core.html#servername">ServerName</a></code> 지시어와 호스트의
    내용이 파일시스템 어디에 있는지를 지정하는 <code class="directive"><a href="../mod/core.html#documentroot">DocumentRoot</a></code> 지시어가 필요하다.</p>

    <div class="note"><h3>주 호스트가 없어진다</h3>
        <p>기존에 사용하던 웹서버에 가상호스트를 추가한다면
        기존에 사용하던 호스트에 대한 <code class="directive"><a href="../mod/core.html#virtualhost">&lt;VirtualHost&gt;</a></code> 블록도 추가해야
        한다. 이 블록에 포함하는 <code class="directive"><a href="../mod/core.html#servername">ServerName</a></code><code class="directive"><a href="../mod/core.html#documentroot">DocumentRoot</a></code>는 전체 <code class="directive"><a href="../mod/core.html#servername">ServerName</a></code><code class="directive"><a href="../mod/core.html#documentroot">DocumentRoot</a></code>와 같아야 한다.
        설정파일에서 이 가상호스트를 가장 먼저 적으면 기본 호스트가
        된다.</p>
    </div>

    <p>예를 들어 <code>www.domain.tld</code> 도메인을 서비스하고
    있었는데 같은 IP 주소에
    <code>www.otherdomain.tld</code>란 가상호스트를 추가하고
    싶다고 가정하자. <code>httpd.conf</code>에 다음과 같이
    추가하면 된다:</p>

    <div class="example"><p><code>
        NameVirtualHost *:80<br />
        <br />
        &lt;VirtualHost *:80&gt;<br />
        <span class="indent">
            ServerName www.domain.tld<br />
            ServerAlias domain.tld *.domain.tld<br />
            DocumentRoot /www/domain<br />
        </span>
        &lt;/VirtualHost&gt;<br />
        <br />
        &lt;VirtualHost *:80&gt;<br />
        <span class="indent">ServerName www.otherdomain.tld<br />
            DocumentRoot /www/otherdomain<br />
        </span>
        &lt;/VirtualHost&gt;<br />
    </code></p></div>

    <p><code class="directive"><a href="../mod/core.html#namevirtualhost">NameVirtualHost</a></code>
    <code class="directive"><a href="../mod/core.html#virtualhost">&lt;VirtualHost&gt;</a></code>
    지시어 둘 모두 <code>*</code> 대신 직접 IP 주소를 지정할
    수도 있다. 예를 들어, 이런식으로 한 IP 주소에 여러 이름기반
    가상호스트들을 돌리고, 다른 주소에 IP기반 혹은 이름기반
    가상호스트들을 돌릴 수 있다.</p>

    <p>어떤 서버는 여러 이름으로 접속할 수 있길 바란다. 이는
    <code class="directive"><a href="../mod/core.html#virtualhost">&lt;VirtualHost&gt;</a></code>
    섹션 안에 <code class="directive"><a href="../mod/core.html#serveralias">ServerAlias</a></code>
    지시어를 사용하여 가능하다. 예를 들어 위의 첫번째 <code class="directive"><a href="../mod/core.html#virtualhost">&lt;VirtualHost&gt;</a></code> 블록에서
    <code class="directive"><a href="../mod/core.html#serveralias">ServerAlias</a></code> 지시어를
    사용하면 열거한 이름으로 같은 웹사이트를 볼 수 있다:</p>

    <div class="example"><p><code>
        ServerAlias domain.tld *.domain.tld
    </code></p></div>

    <p><code>domain.tld</code> 도메인에 있는 모든 호스트에 대한
    요청을 <code>www.domain.tld</code> 가상호스트가 서비스한다.
    이름을 줄때 와일드카드 문자 <code>*</code><code>?</code>
    사용할 수 있다. 물론 <code class="directive"><a href="../mod/core.html#servername">ServerName</a></code>이나 <code>ServerAlias</code>
    이름을 적어주었다고 끝이 아니다. 먼저 이 이름들이 서버의
    IP 주소로 대응하도록 DNS 서버를 알맞게 설정해야 한다.</p>

    <p>마지막으로 <code class="directive"><a href="../mod/core.html#&lt;virtualhost&gt;">&lt;&lt;VirtualHost&gt;&gt;</a></code> 안에 다른
    지시어들을 사용하여 가상호스트를 자세히 설정할 수 있다.
    대부분의 지시어를 사용할 수 있으며, 관련된 가상호스트의 설정만을
    변경한다. 어떤 지시어가 사용가능한지 알려면 지시어의 <a href="../mod/directive-dict.html#Context">사용장소</a>
    확인하라. (<code class="directive"><a href="../mod/core.html#&lt;virtualhost&gt;">&lt;&lt;VirtualHost&gt;&gt;</a></code> 안이 아닌)
    <em>주서버설정</em>에서 지정한 설정 지시어는 가상호스트에
    같은 설정 지시어가 없는 경우에만 사용된다.</p>

    <p>요청을 받으면 서버는 먼저 <code class="directive"><a href="../mod/core.html#namevirtualhost">NameVirtualHost</a></code>에서 지정한 IP
    주소인지 검사한다. 그렇다면 그 IP 주소를 가진 <code class="directive"><a href="../mod/core.html#virtualhost">&lt;VirtualHost&gt;</a></code>
    섹션들에서 요청한 호스트명과 일치하는 <code class="directive"><a href="../mod/core.html#servername">ServerName</a></code>이나
    <code>ServerAlias</code>를 찾는다. 찾으면 그 설정을 사용한다.
    적절한 가상호스트를 찾지못하면, IP 주소에 해당하는
    <strong>가상호스트들중 첫번째 것</strong>을 사용한다.</p>

    <p>결과적으로 처음에 나온 가상호스트가 <em>기본</em>
    가상호스트가 된다. IP 주소가 <code class="directive"><a href="../mod/core.html#namevirtualhost">NameVirtualHost</a></code> 지시어에 해당하면,
    <em>주서버</em><code class="directive"><a href="../mod/core.html#documentroot">DocumentRoot</a></code>
    <strong>절대로</strong> 사용하지 않는다. 특정 가상호스트에
    해당하지않는 요청을 설정하려면 설정을 <code class="directive"><a href="../mod/core.html#virtualhost">&lt;VirtualHost&gt;</a></code>에 담고 설정파일에서
    먼저 나오도록 하면 된다.</p>

</div><div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
<div class="section">
<h2><a name="compat" id="compat">오래된 브라우저와 호환</a></h2>

    <p>이미 적었듯이 이름기반 가상호스트가 올바로 동작하기위해
    필요한 정보를 보내지않는 클라이언트가 있다. 이런 클라이언트는
    항상 요청한 IP 주소에 대해 첫번째로 나오는 가상호스트
    (<cite>최초의</cite> 이름기반 가상호스트)가
    서비스한다.</p>

    <div class="note"><h3>얼마나 오래된 것을 말하는가?</h3>
    <p>여기서 오래되었음은 실제로 상당히 오래된 것을 뜻한다.
    오늘날 이런 브라우저를 사용할 일은 거의없다. 요즘
    브라우저는 모두 이름기반 가상호스트에 필요한 <code>Host</code>
    헤더를 보낸다.</p>
    </div>

    <p>이 문제는 약간 거추장스럽지만 <code class="directive"><a href="../mod/core.html#serverpath">ServerPath</a></code> 지시어로 해결할 수 있다:</p>

    <p>설정 예:</p>

    <div class="example"><p><code>
        NameVirtualHost 111.22.33.44<br />
        <br />
        &lt;VirtualHost 111.22.33.44&gt;<br />
        <span class="indent">
            ServerName www.domain.tld<br />
            ServerPath /domain<br />
            DocumentRoot /web/domain<br />
        </span>
        &lt;/VirtualHost&gt;<br />
    </code></p></div>

    <p>이게 무슨 뜻인가? "<code>/domain</code>"로 시작하는
    URI에 대한 요청은 가상호스트 <code>www.domain.tld</code>
    서비스한다.  즉, <code>Host:</code> 헤더를 보내는 클라이언트는
    <code>http://www.domain.tld/</code>만으로도 접근할 수 있지만,
    <code>http://www.domain.tld/domain/</code>으로는 모든
    클라이언트가 페이지에 접근할 수 있다.</p>

    <p>이를 위해 최초의 가상호스트에 있는 페이지에
    <code>http://www.domain.tld/domain/</code>으로 가는 링크를
    넣는다. 그리고 가상호스트 페이지에서는 상대링크 (예를 들어,
    "<code>file.html</code>" 이나 "<code>../icons/image.gif</code>")
    혹은 ("<code>http://www.domain.tld/domain/misc/file.html</code>"이나
    "<code>/domain/misc/file.html</code>"과 같이) 앞에
    <code>/domain/</code>이 붙은 링크만을 사용한다.</p>

    <p>조금 규칙이 필요하지만 이 규칙을 따르면 대부분의 경우
    요즘 것이나 오래된 것이나 관계없이 모든 브라우저로 페이지를
    볼 수 있다.</p>

</div></div>
<div class="bottomlang">
<p><span>가능한 언어: </span><a href="../de/vhosts/name-based.html" hreflang="de" rel="alternate" title="Deutsch">&nbsp;de&nbsp;</a> |
<a href="../en/vhosts/name-based.html" hreflang="en" rel="alternate" title="English">&nbsp;en&nbsp;</a> |
<a href="../fr/vhosts/name-based.html" hreflang="fr" rel="alternate" title="Fran&#231;ais">&nbsp;fr&nbsp;</a> |
<a href="../ja/vhosts/name-based.html" hreflang="ja" rel="alternate" title="Japanese">&nbsp;ja&nbsp;</a> |
<a href="../ko/vhosts/name-based.html" title="Korean">&nbsp;ko&nbsp;</a> |
<a href="../tr/vhosts/name-based.html" hreflang="tr" rel="alternate" title="T&#252;rk&#231;e">&nbsp;tr&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/vhosts/name-based.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>