티스토리 뷰

반응형

아파치 서버와 톰캣이 연동이 되었다는 전제하에.

우선, 호스트를 2개로 분리를 하겠습니다.

호스트를 분리한다는 말은 같은 ip로 서로 다른 도메인을 사용하겠다는 의미입니다.

예를 들어 192.168.xx.xxx 의 ip로 http://www.baver.com http://www.gahoo.com 로 접속하겠다는 의미(?)죠-_-

일단, serverl.xml쪽에 host를 두개 추가해줍니다.

         <Host name="http://www.baver.com" appBase="webapps"
       unpackWARs="true" autoDeploy="true"
       xmlValidation="false" xmlNamespaceAware="false">
    <Context path="" docBase="C:/workspace/baver" debug="0" reloadable="true" workDir = "C:/workspace/baver/work"/>
    </Host>

 

         <Host name="http://www.gahoo.com" appBase="webapps"
       unpackWARs="true" autoDeploy="true"
       xmlValidation="false" xmlNamespaceAware="false">
    <Context path="" docBase="C:/workspace/gahoo debug="0" reloadable="true" workDir = "C:/workspace/gahoo/work"/>
    </Host> 

그리고 나서 아파치 서버의 httpd-vhosts.conf파일에 virtual host를 추가해줍니다.

<VirtualHost *:80>
    DocumentRoot "C:/workspace/baver
    ServerName http://www.baver.com

    <Directory "C:/workspace/baver">
        Options Indexes FollowSymLinks
        AllowOverride All
        Order allow,deny
        Allow from all 
        DirectoryIndex index.jsp
    </Directory>
    RewriteEngine On   
    RewriteCond %{REQUEST_FILENAME} \.(htm|html|xhtml|js|css|jpg|gif|png|swf)$  
    RewriteRule (.*) - [L]   
    RewriteRule (.*) ajp://localhost:8009$1 [P]
</VirtualHost>

<VirtualHost *:80>
    DocumentRoot "C:/workspace/gahoo
    ServerName http://www.gahoo.com

    <Directory "C:/workspace/gahoo">
        Options Indexes FollowSymLinks
        AllowOverride All
        Order allow,deny
        Allow from all 
        DirectoryIndex index.jsp
    </Directory>
    RewriteEngine On   
    RewriteCond %{REQUEST_FILENAME} \.(htm|html|xhtml|js|css|jpg|gif|png|swf)$  
    RewriteRule (.*) - [L]   
    RewriteRule (.*) ajp://localhost:8009$1 [P]
</VirtualHost>

 

그 다음으로 아파치,톰캣 서버를 내렸다가 다시 키신다음에

C:\Windows\System32\drivers\etc 밑에 hosts파일을 연 다음에

http://www.baver.com

http://www.gahoo.com

각각의 호스트를 추가해줍니다.

반응형
반응형
공지사항
최근에 올라온 글
최근에 달린 댓글
Total
Today
Yesterday
«   2024/04   »
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
글 보관함