• <ruby id="5koa6"></ruby>
    <ruby id="5koa6"><option id="5koa6"><thead id="5koa6"></thead></option></ruby>

    <progress id="5koa6"></progress>

  • <strong id="5koa6"></strong>
  • ORACLE之APACHE虛擬服務器設置

    發表于:2007-07-13來源:作者:點擊數: 標簽:
    一 、IP型虛擬主機 IP型虛擬主機指每一虛擬主機對應唯一的IP??赏ㄟ^多個物理網卡或虛擬網口實現多IP,Solaris2.5和 Windows NT都支持這種方式。 兩種配置多虛擬主機的方法: 1、為每一虛擬主機啟動一個httpd進程。 下列情況下使用此方法: ★需考慮 安全 隔

    一 、IP型虛擬主機

    IP型虛擬主機指每一虛擬主機對應唯一的IP??赏ㄟ^多個物理網卡或虛擬網口實現多IP,Solaris2.5和Windows NT都支持這種方式。

    兩種配置多虛擬主機的方法:

    1、為每一虛擬主機啟動一個httpd進程。

    下列情況下使用此方法:

    ★需考慮安全隔離問題,如兩個httpd運行于不同的User、Group、Listen、ServerRoot,兩者用戶除通過Web相互瀏覽數據,無法訪問其他數據。

    ★能提供足夠內存和文件描述器。

    設置方法:

    為每一虛擬主機建立一個獨立的httpd安裝,在每一個安裝路徑的配置文件httpd.conf里,用Listen指令指定進程服務的IP,如:

    Listen 10.68.37.10:80

    2、為所有虛擬主機啟動一個httpd進程。

    下列情況下使用此方法:

    ★允許在虛擬主機間共享httpd配置。

    ★計算機服務于大量的請求,運行多個進程使服務器性能降低成為重要考慮因素。

    設置方法:

    在配置文件httpd.conf里,用VirtualHost指令為每一虛擬主機設置ServerAdmin、ServerName、DocumentRoot、 ErrorLog、TransferLog或CustomLog,如:

    #此處建議用IP

    ServerAdmin webmaster@mail.smallco.com

    DocumentRoot /usr/local/etc/httpd/htdocs/smallco

    ServerName www.smallco.com #建議此處用域名

    ErrorLog /usr/local/etc/httpd/logs/smallco/error_log

    TransferLog /usr/local/etc/httpd/logs/smallco/aclearcase/" target="_blank" >ccess_log



    #此處建議用IP

    ServerAdmin webmaster@mail.baygroup.org

    DocumentRoot /groups/baygroup/www

    ServerName www.baygroup.org #建議此處用域名

    ErrorLog /groups/baygroup/logs/error_log

    TransferLog /groups/baygroup/logs/access_log



    同時要做虛擬網口或網卡的配置,在DNS也要做相應設置。

    二 、名字型虛擬主機(Apache1.3以上版本支持)

    IP型虛擬主機雖好,但不是最佳方案。它要求每一虛擬主機有一專用IP,在某些機器上難于實現。

    名字型虛擬主機是指每一虛擬主機的名字不相同,但IP一樣。它的好處是不限制虛擬主機數量,配置、使用簡單,不需另外的軟硬件。缺點是客戶端必須支持該部分協議,最近版本的瀏覽器都支持,某些老版本瀏覽器不支持。但Apache為此提供了解決方法。

    設置方法:

    在配置文件httpd.conf里,用NameVirtualHost指令設置虛擬主機,如:

    NameVirtualHost 111.22.33.44

    #建議此處用IP

    ServerName www.domain.tld #建議此處用域名

    DocumentRoot /web/domain

    同時,在DNS定義www.domain.tld指向111.22.33.44。

    注意:當在NameVirtualHost指令后使用IP時,任何使用IP的URL請求都是針對虛擬主機的,主服務器從不會響應一個使用IP的URL請求。

    另外,有些服務器希望以多個名字被訪問。例如,假設有某一IP的服務器,希望以名domain.tld、www2.domain.tld都能被訪問,做法是在VirtualHost指令部分使用ServerAlias指令。如:

    ServerAlias domain.tld *.domain.tld

    另附一些虛擬主機的設置實例。

    附:虛擬主機設置實例

    IP型的虛擬主機配置

    Setup 1: 服務器有兩個IP,

    111.22.33.44 server.domain.tld

    111.22.33.55 www.otherdomain.tld

    www.domain.tld 是server.domain.tld 的別名(CNAME),代表主服務器。

    服務器配置:

    ...

    Port 80

    DocumentRoot /www/domain

    ServerName www.domain.tld

    DocumentRoot /www/otherdomain

    ServerName www.otherdomain.tld

    ...

    Setup 2: 基本同Setup1,但不設置專門的主服務器。

    服務器配置:

    ...

    Port 80

    ServerName server.domain.tld

    DocumentRoot /www/domain

    ServerName www.domain.tld

    ...



    DocumentRoot /www/otherdomain

    ServerName www.otherdomain.tld

    ...

    這種設置只有當URL為http://server.domain.tld時才擊中主服務器

    Setup 3: 服務器有兩個IP,

    111.22.33.44 server.domain.tld

    111.22.33.55 www-cache.domain.tld

    www.domain.tld 是server.domain.tld 的別名(CNAME),代表主服務器。

    www-cache.domain.tld是proxy-cache,端口是8080,Web服務器使用默認的80。

    服務器配置:

    ...

    Port 80

    Listen 111.22.33.44:80

    Listen 111.22.33.55:8080

    ServerName server.domain.tld

    DocumentRoot /www/domain

    ServerName www.domain.tld

    ...



    ServerName www-cache.domain.tld

    ...

    order deny,allow

    deny from all

    allow from 111.22.33



    名字型虛擬主機配置

    Setup 1: 服務器有一個IP,

    111.22.33.44 server.domain.tld.

    www.domain.tld和www.sub.domain.tld是別名(CNAMEs) 。

    服務器配置:

    ...

    Port 80

    ServerName server.domain.tld

    NameVirtualHost 111.22.33.44

    DocumentRoot /www/domain

    ServerName www.domain.tld

    ...



    DocumentRoot /www/subdomain

    ServerName www.sub.domain.tld

    ...



    若使用IP訪問服務器,由于 www.domain.tld 有最高優先級,被認為是默認服務器或第一服務器。

    Setup 2:服務器有兩個IP,

    111.22.33.44 server1.domain.tld 用于主服務器

    111.22.33.55 server2.domain.tld 用于虛擬主機別名www.domain.tld用于主服務器

    別名www.otherdomain.tld用于一個虛擬主機,別名www.sub.domain.tld,*.sub.domain.tld 用于另一虛擬主機,服務器配置:

    ...

    Port 80

    ServerName www.domain.tld

    DocumentRoot /www/domain

    NameVirtualHost 111.22.33.55

    DocumentRoot /www/otherdomain

    ServerName www.otherdomain.tld

    ...



    DocumentRoot /www/subdomain

    ServerName www.sub.domain.tld

    ServerAlias *.sub.domain.tld

    ...



    混合型(IP/名字)虛擬主機配置

    Setup:服務器有三個IP,

    111.22.33.44 server.domain.tld 用于名字型虛擬主機

    111.22.33.55 www.otherdomain1.tld 用于IP型虛擬主機

    111.22.33.66 www.otherdomain2.tld 用于IP型虛擬主機

    服務器配置:

    ...

    Port 80

    ServerName server.domain.tld

    NameVirtualHost 111.22.33.44

    DocumentRoot /www/domain

    ServerName www.domain.tld

    ...



    DocumentRoot /www/subdomain1

    ServerName www.sub1.domain.tld

    ...

    DocumentRoot /www/subdomain2

    ServerName www.sub2.domain.tld

    ...

    DocumentRoot /www/otherdomain1

    ServerName www.otherdomain1.tld

    ...

    DocumentRoot /www/otherdomain2

    ServerName www.otherdomain2.tld

    ...



    端口型虛擬主機配置

    Setup: 服務器有一個IP,

    111.22.33.44 www.domain.tld

    不需要另外的別名或IP,采用端口型虛擬主機即可設置一個配置有別于主服務器的虛擬主機。

    服務器配置:

    ...

    Listen 80

    Listen 8080

    ServerName www.domain.tld

    DocumentRoot /www/domain

    DocumentRoot /www/domain2

    ...



      

    原文轉自:http://www.kjueaiud.com

    老湿亚洲永久精品ww47香蕉图片_日韩欧美中文字幕北美法律_国产AV永久无码天堂影院_久久婷婷综合色丁香五月

  • <ruby id="5koa6"></ruby>
    <ruby id="5koa6"><option id="5koa6"><thead id="5koa6"></thead></option></ruby>

    <progress id="5koa6"></progress>

  • <strong id="5koa6"></strong>