用apache要如何設定兩個以上的虛擬網站啊..?



贊助商連結


emilee
2003-05-24, 03:23 PM
我有16個固定IP...!
我的SERVER是WIN32+APACHE
在httpd.conf如何設定兩個以上的網站啊..?
以IP為主的

贊助商連結


repsol
2003-05-24, 06:48 PM
apache的Virtual Hosts 有兩種做法
Name-based 和 IP-based Virtual Hosts


IP-based virtual hosts use the IP address of the connection to determine the correct virtual host to serve. Therefore you need to have a separate IP address for each host.

每一個host擁有自己的ip

With name-based virtual hosting, the server relies on the client to report the hostname as part of the HTTP headers. Using this technique, many different hosts can share the same IP address.

每個host都共用同一個ip

你的需求大概是要用 IP-based Virtual Hosts

那就參考一下這個章節
http://httpd.apache.org/docs/vhosts/ip-based.html

emilee
2003-05-24, 07:13 PM
有沒有中文的資料啊....?
英文的看無...!!

ryanxyz
2003-05-25, 08:49 PM
用IIS不就好了
windows下的apache效能不是很好
而且安全性要注意

repsol
2003-05-27, 12:26 AM
google 上面資料一堆

http://www.jimmy-lam.com/studyarea/linux/servers/linux_www.htm

IP-Based 是在早期的網頁伺服器上面設定虛擬主機﹐要求每一個虛擬主機都分別有各自不同的 IP﹐這或許是有多張網路卡﹐或是用 IP Aliase 的方式捆綁多個 IP 。但這畢竟是有限的﹐尤其是現在 IP 位址嚴重不足的情況之下。為了解決這個問題﹐後來就發展出 Name-Based 的虛擬主機架設方法﹐也就是將所有的虛擬主機都架在單一的 IP 之上﹐這提供的便利當然是非常明顯的﹐特別是對那些提供 hosting 服務的 ISP/ICP 業者來說﹐更是救藥良方。

下面﹐讓我們先看看 IP-Based 的虛擬主機架設方法﹕

在 httpd.conf 檔案最後部份﹐我增加了這些句子﹕


<VirtualHost www.virtual.test>
ServerAdmin [email protected]
DocumentRoot /home/httpd/virtual/virtual1
ServerName www.virtual.test
ErrorLog logs/www.virtual.test-error_log
TransferLog logs/www.virtual.test-access_log
</VirtualHost>




無論如何﹐我們首先要確定 /home/httpd/virtual/virtual1/ 這個目錄存在(回顧一下 access.conf 檔案﹕我已經為這個目錄設定好權限了)。同時 www.virtual.test 的 DNS 也設定好(包括正反解)﹔而且使用 IP Alias 為虛擬主機建立新的 IP 地址(可以有別於目前的子網範圍)。