Hi, 我目前在準備 NCLP 的考試,現在練習到 Apache2 的部分(自行買書練習-書名:NCLP專業認證攻略),我目前自行練習的題目是:
開啟apach2伺服器,建立Name-Based虛擬主機,建立網址
www.example.com, 使用目錄 /srv/www/htdocs,
連入
www.example.com 時顯示 index.html 頁面(內容 It work!).
我的實作環境是 SUSE Linux Enterprise Server 10 + VMware
照書本的做法:
1. yast->DNS server->Zone Editor->設定 www A IP位址(假設192.168.1.1)
2. yast->HTTP server->Hosts->Add->Server Name:
www.example.com Server Content Root: /srv/www/htdocs
Administrator E-Mail: root@localhost
IP Address: 192.168.1.1
設定 HTTP Headers
3. w3m
http://www.example.com結果是:
You have reached this web page by typing "example.com", "example.net", or "example.log" into your web browser.
These domain names are reserved for use in documentation and are not available for registration. See RFC 2606, Section 3.
但是如果在/etc/hosts 中,加入 192.168.1.1
www.example.com 後, index.html 的內容就顯示的出來,甚至連 DNS server 都不用設定(第一步驟).
問題:
想請問我的這樣做法正確嗎?
因為照書本教的根本做不出來,所以擔心考試時,這樣做不知道行不行?
另外,想請問 Apache2 的 Name-Based 虛擬網頁伺服器一定要先在 DNS Server 中做網域名稱的設定嗎?