본문 바로가기

WEB-SERVER/OHS & JBCS & Apache

[Apache2.2 / OHS 11g ~ 12.1.3] VirtualHost 구성 시 주의 사항

728x90

※ 이 글은 Apache 2.4에는 적용 안 되는 글입니다.

 

1. 구성환경

WAS : WebLogic 12.2.1.4

WEB : Oracle HTTP Server 12.1.3 (apache 2.2 버전)

 

평범하게 VirtualHost를 구성하면 되는 줄 알고 했는데, 다음과 같은 현상이 나타났다.

 

내가 구성하려는 방식 NameBased VirtualHost로, 하나의 IP Address에 여러개의 가상호스트를 운용하는 방법이다.

이 경우에는 링크의 글을 참고하면, NameVirtualHost를 명시해야 한다.

https://httpd.apache.org/docs/2.2/vhosts/name-based.html

 

이름기반 가상호스트 지원 - Apache HTTP Server Version 2.2

Please note This document refers to the 2.2 version of Apache httpd, which is no longer maintained. The active release is documented here. If you have not already upgraded, please follow this link for more information. You may follow this link to go to the

httpd.apache.org

 

최종적으로는 아래와 같이 설정하고서 부터는 각각의 주소에 따른 페이지가 호출 되었다.

# NOTE : This is a template to configure mod_weblogic.

LoadModule weblogic_module   "${PRODUCT_HOME}/modules/mod_wl_ohs.so"

# This empty block is needed to save mod_wl related configuration from EM to this file when changes are made at the Base Virtual Host Level
#<IfModule weblogic_module>
#      WebLogicHost <WEBLOGIC_HOST>
#      WebLogicPort <WEBLOGIC_PORT>
#      MatchExpression *.jsp
#</IfModule>

# <Location /weblogic>
#      SetHandler weblogic-handler
#      PathTrim /weblogic
#      ErrorPage  http:/WEBLOGIC_HOME:WEBLOGIC_PORT/
#  </Location>
#
NameVirtualHost 192.xxx.xx.xxx:80
<VirtualHost 192.xxx.xx.xxx:80>
    ServerName prod.xxx.com
    DocumentRoot "/sw/webtier12/domains/ohs_domain/config/fmwconfig/components/OHS/comp1/prod"
        <Directory "/sw/webtier12/domains/ohs_domain/config/fmwconfig/components/OHS/comp1/prod">

        #
        # Possible values for the Options directive are "None", "All",
        # or any combination of:
        #   Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews
        #
        # Note that "MultiViews" must be named *explicitly* --- "Options All"
        # doesn't give it to you.
        #
        # The Options directive is both complicated and important.  Please see
        # http://httpd.apache.org/docs-2.2/mod/core.html#options
        # for more information.
        #
            Options FollowSymLinks

        #
        # AllowOverride controls what directives may be placed in .htaccess files.
        # It can be "All", "None", or any combination of the keywords:
        #   Options FileInfo AuthConfig Limit
        #
            AllowOverride None

        #
        # Controls who can get stuff from this server.
        #
            Order allow,deny
            Allow from all

        #
        # DirectoryIndex: sets the file that Apache will serve if a directory
        # is requested.
        #
            DirectoryIndex index.html

        </Directory>
#        ErrorLog "||${PRODUCT_HOME}/bin/rotatelogs /logs/webtier/ohs/ohs12214/webmail/error_log"
#        CustomLog "||${PRODUCT_HOME}/bin/rotatelogs /logs/webtier/ohs/ohs12214/webmail/access_log 43200" combined


        <IfModule weblogic_module>
                MatchExpression *
                #MatchExpression *.jsp
                #MatchExpression *.do
                #WLExcludePathOrMimeType *.html,*.css,*.js
                Idempotent OFF
                WLCookieName JSESSIONID
                WLIOTimeoutSecs 600
        </IfModule>
        <Location />
                WebLogicCluster 192.xxx.xx.101:7002
                RewriteEngine on
                RewriteCond %{HTTPS} off
                RewriteRule (.*) https://%{SERVER_NAME}:443%{REQUEST_URI} [R=301,L]
                SetHandler weblogic-handler
        </Location>

</VirtualHost>

NameVirtualHost 192.xxx.xx.xxx:80
<VirtualHost 192.xxx.xx.xxx:80>
    ServerName test.xxx.com
    DocumentRoot "/sw/webtier12/domains/ohs_domain/config/fmwconfig/components/OHS/comp1/test"
        <Directory "/sw/webtier12/domains/ohs_domain/config/fmwconfig/components/OHS/comp1/test">

        #
        # Possible values for the Options directive are "None", "All",
        # or any combination of:
        #   Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews
        #
        # Note that "MultiViews" must be named *explicitly* --- "Options All"
        # doesn't give it to you.
        #
        # The Options directive is both complicated and important.  Please see
        # http://httpd.apache.org/docs-2.2/mod/core.html#options
        # for more information.
        #
            Options FollowSymLinks

        #
        # AllowOverride controls what directives may be placed in .htaccess files.
        # It can be "All", "None", or any combination of the keywords:
        #   Options FileInfo AuthConfig Limit
        #
            AllowOverride None

        #
        # Controls who can get stuff from this server.
        #
            Order allow,deny
            Allow from all

        #
        # DirectoryIndex: sets the file that Apache will serve if a directory
        # is requested.
        #
            DirectoryIndex index.html

        </Directory>
#        ErrorLog "||${PRODUCT_HOME}/bin/rotatelogs /logs/webtier/ohs/ohs12214/webmail/error_log"
#        CustomLog "||${PRODUCT_HOME}/bin/rotatelogs /logs/webtier/ohs/ohs12214/webmail/access_log 43200" combined

        <IfModule weblogic_module>
                MatchExpression *
                #MatchExpression *.jsp
                #MatchExpression *.do
                #WLExcludePathOrMimeType *.html,*.css,*.js
                Idempotent OFF
                WLCookieName JSESSIONID
                WLIOTimeoutSecs 600
        </IfModule>
        <Location />
                WebLogicCluster 192.xxx.xx.101:7030
                RewriteEngine on
                RewriteCond %{HTTPS} off
                RewriteRule (.*) https://%{SERVER_NAME}:443%{REQUEST_URI} [R=301,L]
                SetHandler weblogic-handler
        </Location>

</VirtualHost>