時(shí)間:2022-09-03 13:12:01 | 來(lái)源:網(wǎng)站運(yùn)營(yíng)
時(shí)間:2022-09-03 13:12:01 來(lái)源:網(wǎng)站運(yùn)營(yíng)
首先,一個(gè)IP綁定多個(gè)域名是很常見(jiàn)的事情,租用的虛擬主機(jī)大多數(shù)都是多個(gè)主機(jī)共享同一個(gè)IP,區(qū)分具體訪問(wèn)的是哪個(gè)主機(jī)要從兩個(gè)方面實(shí)現(xiàn):GET / HTTP/1.1Host: www.google.com
整個(gè)請(qǐng)求會(huì)被發(fā)送到服務(wù)器上,其中有Host字段標(biāo)識(shí)你要請(qǐng)求的網(wǎng)站域名是什么,即使訪問(wèn)的是同一個(gè)IP地址,由于Host字段不同,所以服務(wù)器軟件有辦法區(qū)分具體訪問(wèn)的是哪個(gè)網(wǎng)站。14.23 Host另外,RFC-2616并非HTTP協(xié)議的最新規(guī)范,具體的規(guī)范請(qǐng)參考RFC-2616的描述鏈接:
The Host request-header field specifies the Internet host and port
number of the resource being requested, as obtained from the original
URI given by the user or referring resource (generally an HTTP URL,
as described in section 3.2.2). The Host field value MUST represent
the naming authority of the origin server or gateway given by the
original URL. This allows the origin server or gateway to
differentiate between internally-ambiguous URLs, such as the root "/"
URL of a server for multiple host names on a single IP address.
<VirtualHost 10.0.0.1>以上就定義了兩個(gè)域名http://myhost1.com和http://myhost2.com,分別在不同的根目錄,通過(guò)這樣的配置Apache如果收到http://myhost1.com的請(qǐng)求,那么就到d:/website1里尋找對(duì)應(yīng)的頁(yè)面,如果是http://myhost2.com的請(qǐng)求,那么就到d:/website2里尋找對(duì)應(yīng)的頁(yè)面。
ServerAdmin admin@admin
DocumentRoot "D:/website1"
ServerName http://myhost1.com
DirectoryIndex index.php
</VirtualHost>
<VirtualHost 10.0.0.1>
ServerAdmin admin@admin
DocumentRoot "D:/website2"
ServerName http://myhost2.com
DirectoryIndex index.php
</VirtualHost>
客戶(hù)&案例
營(yíng)銷(xiāo)資訊
關(guān)于我們
客戶(hù)&案例
營(yíng)銷(xiāo)資訊
關(guān)于我們
微信公眾號(hào)
版權(quán)所有? 億企邦 1997-2022 保留一切法律許可權(quán)利。