上一篇介紹了如何在WAMP中設定虛擬網站/主機,現在介紹在LINUX中如何設定?
Last post I demo how to setup the virtual servers in WAMP, now give the example for LINUX APACHE.

在LINUX中的設定,我想應該比WAMP容易些,只要更新一個檔案即可.
It’s easier than WAMP, I think, only one configuration file needs to be updated.

請編輯在/etc/httpd/conf下的httpd.conf,並將以下的設定更新到該檔下.(如圖)
please edit your httpd.conf where located at /etc/httpd/conf, and updated some configuration as below (as screenshot)

最後建議您更新/etc/下的hosts檔案
and the last step I will suggest is to update your hosts file where is located at /etc directory.

在虛擬主機的架構下,APACHE是靠完整的網域名稱解析來決定要如何導下內部設定的那一個虛擬主機.以這個例子而言,我的BLOG完整網域名稱為blog.urcloud.biz,當USER在瀏覽器輸入FQDN時,APACHE即以此為依據去尋找在httpd.conf中virtualhost裡設定的SERVERNAME來對應,如果找到了,就將您引導到適當的首頁.所以,在virtualhostL裡設定正確的servername是非常重要的.你也必須確認在DNS中的設定也是正確的.
in such architecture, apache will identify your FQDN to decide which virtual web site will be redirected. for this example, my domain name of BLOG is blog.urcloud.biz, when you guys input the FQDN on your browser, and then apache will search for the setting of virtual server in httpd.conf, and then forward to the right index page for clients. so, it’s very important when you set up a servername in your virtualhost setting of httpd.conf, you also need to make sure it can be correctly work fine on your DNS setting.

簡言之,此例,假設未在DNS設定正確的FQDN,使用者將無法找到虛擬站台.所以如果你的作業平台為LINUX請試著用nslookup或dig指令,如是WINDOWS,請用nslookup試著查看看,你設定servername是否有正確的解譯名稱.
in short, in this case, if you did not set up a right FQDN on your DNS server, users will not find your virtual web site. to make sure your dns setting is ok, please try to nslookup or dig in your linux or using nslookup in your windows OS.

By Kevin

發佈留言