프로그래밍Tips

Apache 서버에서 가상서버 사용하기

itislord 2003. 5. 6. 12:01
Apache가 설치된 디렉토리에서

< conf/httpd.conf > 편집
::::
::::
#
#ServerName cyber.chch.ac.kr    <-- 중간 쯤에서 서버네임 설정을 막을 것
::::
::::
::::      

# If you want to use name-based virtual hosts you need to define at
# least one IP address (and port number) for them.
#
NameVirtualHost  *:80               // IP 지정을 해서 사용해도 됨 203.232.xxx.xxx         <--- 그 서버의 IP번호


#              마지막 부분에 다음을 설정

<VirtualHost cyber.chch.ac.kr>            <--  맨먼저 그 서버자체에 대한 설정을 한다.
  ServerAdmin webmaster@cyber.chch.ac.kr    
  DocumentRoot /usr/local/apache/htdocs
  ServerName cyber.chch.ac.kr
  ErrorLog /usr/local/apache/logs/error_log
  CustomLog /usr/local/apache/logs/access_log combined
</VirtualHost>  

<VirtualHost mdc.chch.ac.kr>              <--- 가상 서버를 설정한다. 다른 가상서버도 이와 같은 방식으로 한다.
  ServerAdmin webmaster@mdc.chch.ac.kr
  DocumentRoot /user1/home/mdc/public_html
  ServerName mdc.chch.ac.kr
  ErrorLog /user1/home/mdc/public_html/error_log
  CustomLog /user1/home/mdc/public_html/access_log combined
</VirtualHost>

<VirtualHost _default_:*>                  <-- 맨 끝에 Default 가상서버를 설정한다
  ServerAdmin webmaster@cyber.chch.ac.kr
  DocumentRoot /usr/local/apache/htdocs
  ServerName cyber.chch.ac.kr
  ErrorLog /usr/local/apache/logs/error_log
  CustomLog /usr/local/apache/logs/access_log combined
</VirtualHost>                          
* itislord님에 의해서 게시물 복사되었습니다 (2005-04-24 14:18)