標籤:details roo boa 檔案匯入 board server 意思 ror pac
我們這裡主要講最常用的基於網域名稱的虛擬機器主機的配置。
1.記事本開啟hosts檔案,該檔案在:C:\ Windows\ System32\ drivers\etc這個檔案夾下, 在檔案內容的末尾寫入如下內容:
[plain] view plain copy
- 127.0.0.1(不可改) www.fangchan.com(自訂)
2.記事本開啟httpd.conf檔案 ,該檔案在apache的目錄下,如: D:\AppServ\Apache2.2\conf,修改如下兩處:
[plain] view plain copy
- LoadModule vhost_alias_module modules/mod_vhost_alias.so //去掉前面的#,意思是啟用apache的虛擬機器主機功能,第203行
[plain] view plain copy
- Include conf/extra/httpd-vhosts.conf //去掉#的意思是從httpd-vhosts.conf這個檔案匯入虛擬機器主機配置
3.記事本開啟httpd-vhosts.conf檔案,該檔案在apache的目錄下,如:D:\AppServ\ Apache2.2\conf\extra,按照檔案中原有的格式再添加一個VirtualHost,只修改下面有注釋的兩處,如下:
[plain] view plain copy
- <VirtualHost *:80>
- ServerAdmin [email protected]
- DocumentRoot "D:\softlocation\phpstudy\WWW\ecshop" //DocumentRoot後面修改為網站的根路徑
- ServerName www.fangchan.com //ServerName後面修改為hosts中設定的網域名稱
- ErrorLog "logs/dummy-host2.example.com-error.log
- CustomLog "logs/dummy-host2.example.com-access.log" common
- </VirtualHost>
4.重啟伺服器,瀏覽器中輸入www.fangchan.com即可訪問 。
windows下apache虛擬機器主機的配置