1 頁 (共 1 頁)

[問題]虛擬伺服器的設定!

發表於 : 2004-11-02 12:32
hollowaysxp
[問題]虛擬伺服器的設定!
依照文章
http://twftp.org/phpbb/viewtopic.php?t=3891
去做設定。
http://freebsd.lab.mlc.edu.tw/apache/VirtualHost.shtml
之後按照這一篇文章!

我的Apache設定
# 宣告虛擬網站所要使用的IP
NameVirtualHost 220.135.225.x
# 第一個虛擬網站(即原來的主網站名稱)
<VirtualHost tforum.a.la>
DocumentRoot /home/twsbb
ServerName tforum.a.la
</VirtualHost>
用\r
http://tforum.a.la/
這要就轉到/home裡面了(就是我在APache內設定的DocumentRoot)
就變成普通的轉IP。

發表於 : 2004-11-02 22:27
coca
應該是NameVirtualHost *

發表於 : 2004-11-02 23:05
hollowaysxp
QQ,早上我試過後才問的現在已解決!
最初設定

代碼: 選擇全部

# 宣告虛擬網站所要使用的IP 
NameVirtualHost * 
# 第一個虛擬網站(即原來的主網站名稱) 
<VirtualHost tforum.a.la> 
DocumentRoot /home/twsbb 
ServerName tforum.a.la 
</VirtualHost>
之後重新啟動apache會說 *:0沒有虛擬伺服器!
後來才用第一篇文章的設定!後來有問題!所以問了一下!
現在是這樣!就OK了!

代碼: 選擇全部

# 宣告虛擬網站所要使用的IP 
NameVirtualHost * 
# 第一個虛擬網站(即原來的主網站名稱) 
<VirtualHost *> 
DocumentRoot /home/twsbb 
ServerName tforum.a.la 
</VirtualHost> 
這樣就行了!

發表於 : 2004-11-02 23:15
hollowaysxp
再度發現\r

代碼: 選擇全部

# 宣告虛擬網站所要使用的IP 
NameVirtualHost * 
# 第一個虛擬網站(即原來的主網站名稱) 
<VirtualHost *> 
DocumentRoot /home/twsbb 
ServerName tforum.a.la 
</VirtualHost> 
之後所以是Record A 220.135.225.x
所有DNS都被列入第一個虛擬伺服器!
變成我的虛擬伺服器沒用了!

發表於 : 2004-11-02 23:33
幻狼神威
你有設定 port 嗎?
不指定會造成全部都用預設的 Port 80,結果就只有一個會有用.......

代碼: 選擇全部

listen 111.222.333:80
listen 444.555.666:80
listen 111.222.333:8080
再之後才是用 NameVisualHost 去對應上面的 IP ..
再再之後就是 <VisualHost:111.222.333:80> 這個標籤的東東\r
再再再之後就和你上面打的一樣了.......

發表於 : 2004-11-02 23:42
hollowaysxp
我用了一個笨方法!

代碼: 選擇全部

# 宣告虛擬網站所要使用的IP 
NameVirtualHost * 
# 第一個虛擬網站(即原來的主網站名稱) 
<VirtualHost *> 
DocumentRoot /home/
ServerName twsbb.a.la 
</VirtualHost> 

代碼: 選擇全部

# 宣告虛擬網站所要使用的IP 
NameVirtualHost * 
# 第二個虛擬網站(即原來的主網站名稱) 
<VirtualHost *> 
DocumentRoot /home/twsbb/
ServerName tforum.a.la
</VirtualHost> 
這樣都OK了!

我只有一個IP。

發表於 : 2004-11-03 00:37
hollowaysxp
在來我的httpd.conf被我搞的亂糟糟!

代碼: 選擇全部

ScriptAlias   /cgi-bin/      /home/cgi-bin/
ScriptAlias  /webmail     /home/cgi-bin/openwebmail/openwebmail.pl 
這樣設定是原本的!
後來改成

代碼: 選擇全部

ScriptAlias   /cgi-bin/      /home/cgi-bin/
ScriptAlias  /webmail     /home/cgi-bin/openwebmail/openwebmail.pl
ScriptAlias /forum         /home/twsbb/index.php
後來輸入\r
http://twsbb.a.la/forum

Title 500 Internet Server Error

代碼: 選擇全部

Internal Server Error
The server encountered an internal error or misconfiguration and was unable to complete your request.

Please contact the server administrator, twsbb@twsbb.a.la and inform them of the time the error occurred, and anything you might have done that may have caused the error.

More information about this error may be available in the server error log.


--------------------------------------------------------------------------------

Apache/2.0.52 (Unix) PHP/4.3.9 Server at twsbb.a.la Port 80
我不能理解的事?為什麼?
http://twsbb.a.la/webmail
http://tforum.a.la/webmail
都可以到/home/cgi-bin/openwebmail/openwebmail.pl
為什麼forum設定無法到/home/twsbb/index.php

發表於 : 2004-11-03 22:56
幻狼神威
hollowaysxp 寫:我只有一個IP。
hollowaysxp 寫:我不能理解的事?為什麼?
http://twsbb.a.la/webmail
http://tforum.a.la/webmail
都可以到/home/cgi-bin/openwebmail/openwebmail.pl
為什麼forum設定無法到/home/twsbb/index.php
在你只有一個ip的前題下,不用 Port 區隔開,你的虛擬伺服器設定一定會亂掉!

以下是正常的用法.......(應該大部份的教學文件也是這麼寫)

代碼: 選擇全部

listen 111.222.333:80
listen 111.222.333:808
listen 111.222.333:8080
宣告虛擬網站所要使用的IP

代碼: 選擇全部

NameVirtualHost *:80
NameVirtualHost *:808
NameVirtualHost *:8080

設定虛擬網站

代碼: 選擇全部

<VirtualHost *:80> 
DocumentRoot /home/
ServerName twsbb.a.la1 
</VirtualHost> 

<VirtualHost *:808> 
DocumentRoot /home/cgi-bin/openwebmail/
ServerName twsbb.a.la2 
</VirtualHost> 

<VirtualHost *:8080> 
DocumentRoot /home/twsbb/
ServerName twsbb.a.la3 
</VirtualHost> 
最重點:首個 <VirtualHost> 內的 DocumentRoot 必須跟 main_server 的DocumentRoot 設定一致。因為當宣告 NameVirtualHost 後,Apache 會把首個 <VirtualHost> 內的 DocumentRoot 略過....

再試看看吧....... ;)