티스토리 뷰

WEB,WAS/Web Server

[Apache] Virtualhost 설정

빼인트 2010. 10. 8. 11:09

Apache VirtualHost 설정

 

1. 설정 방법 2가지

1) httpd.conf 에 설정하는 방법

2) 별도의 파일에 설정하고 httpd.conf에서 Include 시키는 방법 (추천)

 

 

 

2. 환경 설정

 

1) 구성계획

- 2개의 도메인 운영 예정( test1.paint.co.kr, test2.paint.co.kr)

- Port는 두 도메인 모두 7070 포트 사용

- Docroot

  test1.paint.co.kr : /home/paint/vhost/vhost1

  test2.paint.co.kr : /home/paint/vhost/vhost2

 

2) httpd_vhost.conf 수정

$APACHE_HOME/conf/extra] # vi httpd_vshot.conf

=======================================

NameVirtualHost xxx.xxx.x.191:7070

 

<VirtualHost xxx.xxx.x.191:7070>

    DocumentRoot "/home/paint/vhost/vhost1"   <-- DocRoot  지정

    ServerName test1.paint.co.kr  <-- 도메인명 

    ServerAlias test11.paint.co.kr  <-- 추가적으로 설정할 도메인명

    ErrorLog "logs/vhost1.error_log" <-- errorlog 설정

    CustomLog "logs/vhost1.access_log" common <-- accesslog 설정

</VirtualHost>

 

<VirtualHost xxx.xxx.x.191:7070>

    DocumentRoot "/home/paint/vhost/vhost2"

    ServerName test2.paint.co.kr

    ServerAlias test22.paint.co.kr

    ErrorLog "logs/vhost2.error_log"

    CustomLog "logs/vhost2.access_log" common

</VirtualHost>

 

 

# 반드시 아래와 같이 디렉토리 권한을 주어야 함. 권한을 주지 않을 경우, Forbidden 에러 발생.

<Directory "/home/paint/vhost">

    Options FollowSymLinks

    AllowOverride None

    Order allow,deny

    Allow from all

</Directory>

=======================================

 

3) httpd.conf 수정

$APACHE_HOME/conf/extra] # vi httpd_vshot.conf

- 아래 내용 추가

=======================================

#include "conf/extra/httpd-vhosts.conf"

=======================================


댓글
공지사항
최근에 올라온 글
최근에 달린 댓글
Total
Today
Yesterday
«   2024/05   »
1 2 3 4
5 6 7 8 9 10 11
12 13 14 15 16 17 18
19 20 21 22 23 24 25
26 27 28 29 30 31
글 보관함