RadarURL
Skip to content
2010.04.28 18:13

가상 호스트 설정법

조회 수 6950 추천 수 0 댓글 0
?

단축키

Prev이전 문서

Next다음 문서

크게 작게 위로 아래로 댓글로 가기 인쇄
?

단축키

Prev이전 문서

Next다음 문서

크게 작게 위로 아래로 댓글로 가기 인쇄

직접 버추얼 호스트(Virtual Host) 설정하는 방법을 설명드리겠습니다.


 


버추얼 호스트를 이용하시면 여러개의 도메인이 있는 경우,


 


한개의 서버에서 각각의 도메인에 맞는 홈페이지를 운영하실 수 있습니다.


 


오토셋 4.1 버전부터는 오토셋 메뉴를 통해 간단히 추가하고 변경하고 관리하실 수 있습니다.


 


http://cafe.naver.com/autoset/263 를 참고하세요.


 


 

vh01.jpg

 

 

직접 설정하시기 위해서는 웹 서버의 vhost.conf 파일을 수정해주셔야 합니다.

 

오토셋 설치 폴더serverApache2conf 폴더로 이동해주세요.

 


vh02.jpg

 

 

이동하시면 위와 같이 vhost.conf 파일이 있습니다.

 

이 파일을 EditPlus 나 편집기로 열어주세요.

 

 


vh03.jpg

 

위와 같이 33줄짜리 샘플 코드를 보실 수 있는데요,

 

버추얼 호스트 설정은 매우 간단하답니다.

 

자, 이제 아래와 같이 따라 해볼까요...?

 


vh04.jpg

 

위의 샘플에 직접 수정하셔도 되고, 저와 같이 복사(Ctrl + c) 해서 붙여넣기(Ctrl + v) 하신 다음 수정하셔도 됩니다.

 

먼저, 처음 버추얼 호스트를 설정하시는 것이기 때문에 이 기능을 사용하겠다는 것을

 

웹 서버에 알려줘야 합니다.

 

알려주는 방법이 바로 위의 그림에서 35 번째 줄의 " NameVirtualHost 192.168.1.3:80 " 라고 되어 있는 부분입니다.

 

여기서! 주의 하실 점은 192.168.1.3 이라고 되어 있는 부분은 여러분의 IP주소로 입력해주셔야 합니다.

 

고정 IP주소가 아니신 분은 별표(*)를 입력해주셔도 되겠습니다만,

 

IP 주소를 입력해주시는 것을 권장합니다.

 

별표(*)로 입력하실 때는 샘플과 같이 "NameVirtualHost *:80" 라고 입력해주시면 됩니다.

 

 

그리고, HTML 태그 같이 생긴.. 부분이 있지요?

 






#<VirtualHost *:80>


#    ServerAdmin webmaster@dummy-host.example.com


#    DocumentRoot /www/docs/dummy-host.example.com


#    ServerName dummy-host.example.com


#    ErrorLog logs/dummy-host.example.com-error_log


#    CustomLog logs/dummy-host.example.com-access_log common


#</VirtualHost>


 


27~33줄에 있는 샘플 코드를 복사에서 그림과 같이 수정합니다.

 

 






<VirtualHost 192.168.1.3:80>
    ServerAdmin administrator@autoset.org
    DocumentRoot "c:/autoset/subdomain/cafe.autoset.org"
    ServerName cafe.autoset.org
    ErrorLog logs/cafe.autoset.org-error_log
    CustomLog logs/cafe.autoset.org-access_log common
</VirtualHost>


 

 

그림의 코드에 대해 설명드리면 <VirtualHost 192.168.1.3:80> 은 앞서

 

NameVirtualHost 부분에서 설정한 IP주소와 포트번호가 들어가게 됩니다.

 

즉, 앞에서 별표(*)로 설정하셨다면 샘플과 같이 *:80 으로 해주셔야 되겠습니다.

 

그리고 ServerAdmin 다음의 이메일 주소에는 관리자의 메일주소를 입력해주세요.

 

ServerName 다음에는 도메인 네임을 입력해주세요. (여기서는 cafe.autoset.org 라고 입력했지요)

 

그리고 cafe.autoset.org 로 접속시 보여질 홈페이지 파일들이 있는 경로를

 

DocumentRoot 다음에 입력해주세요.

 

그림에서는 C:autosetsubdomaincafe.autoset.org 의 위치를 지정 한 것입니다.

 

여러분의 홈페이지 파일이 있는 위치를 지정해주시면 되겠습니다.

 

단, 주의 하실 점이 주소 부분에서 역슬래시() 가 아니라 슬래시(/) 로 입력해주셔야 합니다.

 

그래서 그림에서 C:autosetsubdomaincafe.autoset.org 가 아니라,

 

C:/autoset/subdomain/cafe.autoset.org 라고 입력한 것입니다.

 

 

그리고 생략해도 되는 부분입니다만, 저는 로그 추적을 위해 추가했는데요,

 

바로 ErrorLog 와 CustomLog 부분입니다.

 

ErrorLog 에는 웹 서버 시작시 오류가 발생했거나 서비스 도중에 오류가 발생(CGI Error 등) 발생했을 경우 기록이 남고, 

 

CustomLog 에는 접속자에 대한 기록을 남기도록 해두었습니다.

 

각 도메인 별로 남기기 위해 위와 같이 cafe.autoset.org-error_log 와 같이 도메인 명을 넣어 주었습니다.

 

[생략하실 때는 위 2줄을 과감히 삭제!! 해주시면 되겠습니다]

 

 

 

여기까지 하시고, 오토셋 [파일] 메뉴의 [웹 서버 재시작] 을 누르시거나,

 

[웹 서버 멈춤] 하시고 [웹 서버 시작] 을 하시면 변경된 설정이 적용되어 가동이 된답니다.

 

 

*** 물론, 이 설정만으로는 해당 도메인으로 접속하실 수 없습니다. ***

 

해당 도메인에 설정된 네임서버(DNS)에서 여러분의 컴퓨터로 접속하라고 지시를 해줘야 겠지요..

 

 

 

도메인이 여러개라면???

 

아래 그림과 같이 <VirtualHost> 에서 </VirutalHost> 부분만 더 복사해서

 

도메인 이름과 DocumentRoot 부분, ErrorLog, CustomLog 만 수정해주시면 되겠습니다.

 

그리고 설정 변경 후, 재시작 하시는 것 잊지 마시구요!!

 


vh05.jpg


 


 


 


헉!! 이봐 키놀!


도메인은 여러개지만, 한개의 같은 홈페이지를 보여주면 되는데!!!


 


위와 같은 경우?!


 


간단합니다!!


 







<VirtualHost 192.168.1.3:80>
    ServerAdmin administrator@autoset.org
    DocumentRoot "c:/autoset/subdomain/cafe.autoset.org"
    ServerName cafe.autoset.org
    ErrorLog logs/cafe.autoset.org-error_log
    CustomLog logs/cafe.autoset.org-access_log common
</VirtualHost>


 


위의 경우는 cafe.autoset.org 만 접속되도록 한 것이지만,


 


아래의 경우에는 cafe.autoset.org 와 cafe-autoset.org , www.cafe-autoset.org 로도 접속되도록 한 것입니다.


 







<VirtualHost 192.168.1.3:80>
    ServerAdmin administrator@autoset.org
    DocumentRoot "c:/autoset/subdomain/cafe.autoset.org"
    ServerName cafe.autoset.org


    ServerAlias cafe-autoset.org www.cafe-autoset.org
    ErrorLog logs/cafe.autoset.org-error_log
    CustomLog logs/cafe.autoset.org-access_log common
</VirtualHost>


 


 


즉, ServerAlias 라는 구문을 추가 해줘서 접속이 가능케 한 것입니다.


 


 


그런데 키놀!


도메인 포워딩 같은 서비스는 어떻게 하는거야?!


 


wo.to 같은 도메인 포워딩 업체의 웹 서버 설정은 어떻게 하는 것일까요..?


 


도메인 포워딩 업체들은 자기 회사들이 소유한 도메인 앞에 어떠한 문자가 붙더라도 접속이 되어야 합니다.


 


그렇다면....?? 어떻게??


 







<VirtualHost 192.168.1.3:80>
    ServerAdmin administrator@autoset.org
    DocumentRoot "c:/autoset/subdomain/cafe.autoset.org"
    ServerName cafe.autoset.org


    ServerAlias *.cafe.autoset.org
    ErrorLog logs/cafe.autoset.org-error_log
    CustomLog logs/cafe.autoset.org-access_log common
</VirtualHost>


 


위와 같이 별표(*) 를 사용하여 줍니다.


 


위와 같은 설정은 어떻게 되는 거냐구요?


 


cafe.autoset.org 로도 접속이되고,


 


아무거나.cafe.autoset.org 로도 접속이 된다는 겁니다.


 


 


 


더 궁금하신 것 있으면 질문&답변 게시판에 올려주세요~

출처 : http://www.ddcom.co.kr/?mid=DDCom_History&page=3&document_srl=594

?

  1. 아파치 httpd.conf 재시작 없이 설정 적용하기

    Date2016.05.02 ByJAESOO Views270
    Read More
  2. 톰캣 8 소개

    Date2016.01.01 ByJAESOO Views338
    Read More
  3. 리눅스 아파치 로그 뷰어 webalizer, utf-8로 변환하기

    Date2014.12.22 ByJAESOO Views544
    Read More
  4. Webalizer Configuration – Configure Webalizer for SEO

    Date2014.12.22 ByJAESOO Views803
    Read More
  5. Webalizer, AWStats에서 국가 정보 확인하기

    Date2014.12.22 ByJAESOO Views440
    Read More
  6. Webalizer에서 국가별 로그 출력하기

    Date2014.12.22 ByJAESOO Views777
    Read More
  7. Apache: A good Webalizer.conf for the Webalizer Apache Log Analyzer utility

    Date2014.12.22 ByJAESOO Views1236
    Read More
  8. 아파치 로그분석 webalizer 설치

    Date2014.12.21 ByJAESOO Views481
    Read More
  9. Permission denied: .htaccess pcfg_openfile: unable to check htaccess file, ensure it is readable

    Date2014.12.19 ByJAESOO Views743
    Read More
  10. Permission denied: /home/.htaccess pcfg_openfile: unable to check htaccess file

    Date2014.12.19 ByJAESOO Views507
    Read More
  11. pcfg_openfile: unable to check htaccess file, ensure it is readable

    Date2014.12.19 ByJAESOO Views521
    Read More
  12. Tomcat 버전별 설명

    Date2014.06.04 ByJAESOO Views2272
    Read More
  13. Apache 실행환경을 nobody 사용자로 변경

    Date2014.05.28 ByJAESOO Views1510
    Read More
  14. 리눅스 사용자 계정별 웹서버 운영하기

    Date2014.05.27 ByJAESOO Views1872
    Read More
  15. Apache 서버에서 확장자 .htm 파일 내의 php 코드가 실행되지 않는 문제 해결 방법

    Date2014.05.26 ByJAESOO Views1692
    Read More
  16. php 웹사이트에서 파일을 업로드 하는중 100%에서 멈춰버리는 현상 해결

    Date2014.05.16 ByJAESOO Views1826
    Read More
  17. Apache Struts 버전 확인 방법

    Date2014.05.09 ByJAESOO Views2166
    Read More
  18. robots.txt를 현명하게 사용하는 방법

    Date2014.04.11 ByJaeSoo Views1752
    Read More
  19. robots.txt 파일(로봇배제 표준)

    Date2014.04.11 ByJaeSoo Views1759
    Read More
  20. Windows / apache_2.4.3 + php_5.4.10 + mod_fcgid_2.3.7

    Date2013.04.18 ByJaeSoo Views4211
    Read More
Board Pagination Prev 1 2 3 4 Next
/ 4

PageViews   Today : 10378 Yesterday : 5037 Total : 21966430  /  Counter Status   Today : 10031 Yesterday : 4602 Total : 1192754

Edited by JAESOO

sketchbook5, 스케치북5

sketchbook5, 스케치북5

나눔글꼴 설치 안내


이 PC에는 나눔글꼴이 설치되어 있지 않습니다.

이 사이트를 나눔글꼴로 보기 위해서는
나눔글꼴을 설치해야 합니다.

설치 취소