apache虛擬主機設定問題...

顯示結果從第 1 筆 到 7 筆,共計 7 筆
  1. #1
    會員
    註冊日期
    2001-02-06
    所在地區
    ADSL 12M
    討論區文章
    27

    apache虛擬主機設定問題...

    現在使用 adsldns 的 dns...沒有固定 ip .. 是過 aaa.domain.com, bbb.domain.com 都會連到我的主機...

    問題來了...

    apache 的 virtualhost 都要 based on ip ... 即 <VirtualHost xxx.xxx.xxx.xx> ... 可是我沒有固定 ip, 那要怎麼設??

    我試過用 <virtualhost aa.my.com>...結果還是會連到主要的 document root ... 並不會區分開....

    誰有事過成功的呢??教教我...謝謝



  2. #2
    進階會員 repsol 的大頭照
    註冊日期
    2001-06-17
    所在地區
    ADSL 2M/256
    討論區文章
    818
    Using Name-based Virtual Hosts


    To use name-based virtual hosting, you must designate the IP address (and possibly port) on the server that will be accepting requests for the hosts. This is configured using the NameVirtualHost directive. In the normal case where any and all IP addresses on the server should be used, you can use * as the argument to NameVirtualHost. (NameVirtualHost * will work only in version 1.3.13 and later.) Note that mentioning an IP address in a NameVirtualHost directive does not automatically make the server listen to that IP address. See Setting which addresses and ports Apache uses for more details. In addition, any IP address specified here must be associated with a network interface on the server.

    The next step is to create a <VirtualHost> block for each different host that you would like to serve. The argument to the <VirtualHost> directive should be the same as the argument to the NameVirtualHost directive (ie, an IP address, or * for all addresses). Inside each <VirtualHost> block, you will need at minimum a ServerName directive to designate which host is served and a DocumentRoot directive to show where in the filesystem the content for that host lives.

    For example, suppose that both www.domain.tld and www.otherdomain.tld point at an IP address that the server is listening to. Then you simply add the following to httpd.conf:


    NameVirtualHost *

    <VirtualHost *>
    ServerName www.domain.tld
    DocumentRoot /www/domain
    </VirtualHost>

    <VirtualHost *>
    ServerName www.otherdomain.tld
    DocumentRoot /www/otherdomain
    </VirtualHost>


    以上資料來源 :
    http://httpd.apache.org
    「遥か昔、正義に生きる悪魔の伝説があった。
    剣を取って戦い、悪魔の侵略を退けた魔剣士。
    その伝説も、やがて人々の記憶から消えて行った。

    だが2000年の時を経て、魔界はより強大になって甦る。
    圧倒的なパワーで押し寄せる魔界の軍勢。
    本格的な人間界侵攻が始まった…。

    再び訪れた人類の危機に一人の男が立ち上がる。
    伝説の魔剣士の血を引く悪魔狩人(デビルハンター)、その名はダンテ!」

  3. #3
    會員
    註冊日期
    2001-02-06
    所在地區
    ADSL 12M
    討論區文章
    27
    ok了 ..... 謝謝...

  4. #4
    會員
    註冊日期
    2002-01-28
    討論區文章
    19
    對不起喔!上面的看不太懂...敘述一下我的狀況, 請大家幫我看看是哪邊不對
    系統:win-xp
    線路:512/512 adsl 固8
    軟體:AppServ 210

    問題是...
    1.若想利用同一個IP使用不同的網域名稱..如
    abcd.com.tw
    1234.com.tw
    是不是只要修改 http.conf 這個檔案就好了ㄋ

    2.搜尋以前的文章都沒有較完整的說明, 但照著改過如下, 請問如此設定對嗎?
    因為照這樣設定後會出現"找不到網頁" 所以請教各位有經驗的朋友, 謝謝各位

    [PHP]
    NameVirtualHost 203.204.203.204

    <VirtualHost 203.204.203.204>
    ServerAdmin [email protected]
    DocumentRoot /www
    ServerName abcd.com.tw
    ErrorLog logs/abcd-error.log
    CustomLog logs/abcd-access.log common
    </VirtualHost>

    <VirtualHost 203.204.203.204>
    ServerAdmin [email protected]
    DocumentRoot /www/xoops
    ServerName 1234.com.tw
    ErrorLog logs/1234-error.log
    CustomLog logs/1234-access.log common
    </VirtualHost>
    [/PHP]

  5. #5
    會員
    註冊日期
    2001-02-06
    所在地區
    ADSL 12M
    討論區文章
    27
    同一IP使用多Domain除了 httpd.conf 要設定之外,還要設定 DNS 才行...只改 httpd.conf 是沒有用的~~~


    最初由 蓋瑞 發表
    對不起喔!上面的看不太懂...敘述一下我的狀況, 請大家幫我看看是哪邊不對
    系統:win-xp
    線路:512/512 adsl 固8
    軟體:AppServ 210

    問題是...
    1.若想利用同一個IP使用不同的網域名稱..如
    abcd.com.tw
    1234.com.tw
    是不是只要修改 http.conf 這個檔案就好了ㄋ

    2.搜尋以前的文章都沒有較完整的說明, 但照著改過如下, 請問如此設定對嗎?
    因為照這樣設定後會出現"找不到網頁" 所以請教各位有經驗的朋友, 謝謝各位

    [PHP]
    NameVirtualHost 203.204.203.204

    <VirtualHost 203.204.203.204>
    ServerAdmin [email protected]
    DocumentRoot /www
    ServerName abcd.com.tw
    ErrorLog logs/abcd-error.log
    CustomLog logs/abcd-access.log common
    </VirtualHost>

    <VirtualHost 203.204.203.204>
    ServerAdmin [email protected]
    DocumentRoot /www/xoops
    ServerName 1234.com.tw
    ErrorLog logs/1234-error.log
    CustomLog logs/1234-access.log common
    </VirtualHost>
    [/PHP]



  6. #6
    會員
    註冊日期
    2002-01-28
    討論區文章
    19
    那...請問要如何設定ㄋ
    可否教教我或是有相關的書籍可以參考
    那麼 httpd.conf 是不是醬子設定便OKㄋ
    謝謝您

  7. #7
    會員
    註冊日期
    2001-02-06
    所在地區
    ADSL 12M
    討論區文章
    27
    httpd.conf 的部分這樣設定是可以的...DNS 的部分主要是讓所有的網域可以指向同一個 IP....設定方式請自行參考 bind 文件~~~~


    最初由 蓋瑞 發表
    那...請問要如何設定ㄋ
    可否教教我或是有相關的書籍可以參考
    那麼 httpd.conf 是不是醬子設定便OKㄋ
    謝謝您

類似的主題

  1. 【問題】So-net虛擬主機服務
    作者:randychen 所在討論版:☉ -- 虛 擬 主 機 討 論 版
    回覆: 0
    最後發表: 2007-06-19, 08:34 PM
  2. 【問題】另一個 apache 虛擬主機設定問題
    作者:蓋瑞 所在討論版:☉ -- 架 站 DIY 討 論 版
    回覆: 4
    最後發表: 2003-09-15, 10:00 AM
  3. 【詢問】虛擬主機的設定問題
    作者:jackyilk 所在討論版:☉ -- 架 站 DIY 討 論 版
    回覆: 5
    最後發表: 2003-09-14, 07:54 PM
  4. apache虛擬主機設定問題............................【求助】
    作者:ELIJAHY 所在討論版:☉ -- 架 站 DIY 討 論 版
    回覆: 20
    最後發表: 2003-09-07, 11:59 PM
  5. 【求助】如何讓每個不同Hostname的Apache虛擬主機使用不同的SSL憑證
    作者:PHINEAR 所在討論版:☉ -- 架 站 DIY 討 論 版
    回覆: 0
    最後發表: 2003-08-21, 08:32 PM

 

此網頁沒有從搜尋引擎而來的訪客

發表文章規則

  • 不可以發表新主題
  • 不可以回覆文章
  • 不可以上傳附加檔案
  • 不可以編輯自己的文章
  •