티스토리 뷰

WEB,WAS/Web Server

[Apache] Virtual Host (Vhosts)

빼인트 2010. 1. 28. 11:20

 

1. httpd.conf

ServerName 192.168.11.76:9080

# 디렉토리 권한 설정. apache의 기본 디렉토리가 아닌, 다른 디렉토리에 AP소스가 존재한다면 아래와 같이 등록하여 주어야 한다.

<Directory "/home/apache/webapps/app1">
    AllowOverride None
    Options None
    Order allow,deny
    Allow from all
</Directory>

<Directory "/home/apache/webapps/app2">
    AllowOverride None
    Options None
    Order allow,deny
    Allow from all
</Directory>

# vhost.conf Include한다.
Include conf/vhost.conf

# mod_jk 모듈 로딩
LoadModule jk_module modules/mod_jk-1.2.26_httpd-2.2.8_linux-k2.6_x86.so

<IfModule mod_jk.c>
  JkWorkersFile conf/workers.properties
  JkLogFile logs/mod_jk.log
  JkLogLevel info
</IfModule>


2. vhost.conf

NameVirtualHost 192.168.11.76:9080
# IP 및 Port설정
<VirtualHost 192.168.11.76:9080>
    # DocRoot 설정
    DocumentRoot "/home/apache/webapps/app1"
    # 도메인 설정
    ServerName app1.paint.co.kr
    # 도메인 여러 개 설정시
    #ServerAlias app1.paint.co.kr app2.paint.co.kr
    # 에러로그파일 및 경로 지정
    ErrorLog "logs/app1_error.log"
    # 일반로그파일 경로과 포맷 지정
    CustomLog "logs/app1_access.log" common

    <IfModule dir_module>
        DirectoryIndex index.html index.jsp
    </IfModule>
    JkMount /*.jsp app1
</VirtualHost>

<VirtualHost 192.168.11.76:9080>
    DocumentRoot "/home/apache/webapps/app2"
    ServerName app2.paint.co.kr
    ErrorLog "logs/app2_error.log"
    CustomLog "logs/app2_access.log" common

    <IfModule dir_module>
        DirectoryIndex index.html
    </IfModule>
    JkMount /*.jsp app2
</VirtualHost>

<VirtualHost 192.168.11.76:9080>
    DocumentRoot "/home/apache/apache-2.2.14/htdocs"
    ServerName 192.168.11.76
    ErrorLog "logs/node_error.log"
    CustomLog "logs/node_access.log" common
    
    <IfModule dir_module>
        DirectoryIndex index.html index.jsp
    </IfModule>
    #JkMount /*.jsp worker1
</VirtualHost>

 

3. Sample

# Virtual Hosts

#
# If you want to maintain multiple domains/hostnames on your
# machine you can setup VirtualHost containers for them. Most configurations
# use only name-based virtual hosts so the server doesn't need to worry about
# IP addresses. This is indicated by the asterisks in the directives below.
#

# Please see the documentation at
# <URL:http://httpd.apache.org/docs/2.2/vhosts/>
# for further details before you try to setup virtual hosts.
#

# You may use the command line option '-S' to verify your virtual host
# configuration.

#
# Use name-based virtual hosting.
#

NameVirtualHost *:80

#
# VirtualHost example:
# Almost any Apache directive may go into a VirtualHost container.
# The first VirtualHost section is used for all requests that do not
# match a ServerName or ServerAlias in any <VirtualHost> block.
#

<VirtualHost *:80>
    ServerAdmin webmaster@dummy-host.example.com
    DocumentRoot "/home/apache/apache-2.2.14_mpm/docs/dummy-host.example.com"
    ServerName dummy-host.example.com
    ServerAlias www.dummy-host.example.com
    ErrorLog "logs/dummy-host.example.com-error_log"
    CustomLog "logs/dummy-host.example.com-access_log" common
</VirtualHost>

<VirtualHost *:80>
    ServerAdmin webmaster@dummy-host2.example.com
    DocumentRoot "/home/apache/apache-2.2.14_mpm/docs/dummy-host2.example.com"
    ServerName dummy-host2.example.com
    ErrorLog "logs/dummy-host2.example.com-error_log"
    CustomLog "logs/dummy-host2.example.com-access_log" common
</VirtualHost>

 

'WEB,WAS > Web Server' 카테고리의 다른 글

[Apache] Welcome-file 설정  (0) 2010.07.17
[Apache] 디렉토리 보안설정  (0) 2010.07.17
[Apache] apachectl 명령어  (0) 2010.07.16
[Apache] DSO(Dynamic Shared Object) 방식  (0) 2010.07.16
[Apache] httpd.conf 한글 메뉴얼  (1) 2010.07.12
[Linux] Apache설치  (0) 2010.06.30
[WebtoB] MaxQCount 와 MaxQUrl  (0) 2010.03.04
[WebtoB/JEUS] SvrChkTime, read-timeout  (0) 2010.03.04
댓글
공지사항
최근에 올라온 글
최근에 달린 댓글
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
글 보관함