티스토리 뷰

728x90
반응형

Normally, you don't care about these terms as if there are not these attributions in web subsystem because it is only for special case. This blog will talk about the case when these are needed.


"virtual-server".... it sounds like you heard it from some places. Yes, you heard "VirtualHost" a lot from apache side because it is kind of default configuration. By the way, these 2 terms are very similar so I will compare those one.


The term Virtual Host refers to the practice of running more than one web site(such as company1.example.com and company2.example.com) on a single machine. (From http://httpd.apache.org/docs/current/en/vhosts/index.html)

This means that multiple host name can share same port via several ways.


According to same context, virtual-server is for sharing same context-root. By default, it is not possible to deploy multiple applications that have same context-root on an application server. However, sometimes you want to do this case because adding an application server just for deploying same context-root application is big cost. Hence, JBoss server provide "virtual-server" option to solve this problem.


This is sample to deploy applications that use "/"(root-context) on an JBoss instance.

Test Flow :     

  Browser

  Real Location

  ts1.webserver1.org/index.jsp

 App1/index.jsp

 ts1.webserver2.org/index.jsp

 App2/index.jsp


Configuration * App1.war(jboss-web.xml)

 <jboss-web>
    <context-root>/</context-root>
    <virtual-host>webserver1</virtual-host>
</jboss-web>


*App2.war(jboss-web.xml)

 <jboss-web>
    <context-root>/</context-root>
    <virtual-host>webserver2</virtual-host>
</jboss-web>


*standalone.xml

...

<subsystem xmlns="urn:jboss:domain:web:1.4" default-virtual-server="webserver1" instance-id="ts4" native="false">
            <connector name="http" protocol="HTTP/1.1" scheme="http" socket-binding="http"/>
            <connector name="ajp" protocol="AJP/1.3" scheme="http" socket-binding="ajp"/>
            <virtual-server name="webserver1" enable-welcome-root="false" default-web-module="App1.war">
                <alias name="localhost"/>
                <alias name="ts1.webserver1.org"/>
            </virtual-server>
            <virtual-server name="webserver2" enable-welcome-root="false" default-web-module="App2.war">
                <alias name="localhost"/>
                <alias name="ts1.webserver2.org"/>
            </virtual-server>
        </subsystem>

... 


For your information)

As I mentioned before, it is very similar to VirtualHost in Apache thus, I show you sample of "Virtual Host".

<VirtualHost *:80>
    ServerName ts1.webserver1.org
    DocumentRoot /home/jooho/Applications/EWS/jboss-ews-2.0/docs/test1
</VirtualHost>

<VirtualHost *:80>
   ServerName ts1.webserver2.org
   DocumentRoot /home/jooho/Applications/EWS/jboss-ews-2.0/docs/test2
</VirtualHost> 



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