windows下apache虛擬機器主機的配置

來源:互聯網
上載者:User

標籤:details   roo   boa   檔案匯入   board   server   意思   ror   pac   

我們這裡主要講最常用的基於網域名稱的虛擬機器主機的配置。

1.記事本開啟hosts檔案,該檔案在:C:\ Windows\ System32\ drivers\etc這個檔案夾下, 在檔案內容的末尾寫入如下內容:

 

[plain] view plain copy 
  1. 127.0.0.1(不可改) www.fangchan.com(自訂)  

 

2.記事本開啟httpd.conf檔案 ,該檔案在apache的目錄下,如: D:\AppServ\Apache2.2\conf,修改如下兩處:

 

[plain] view plain copy 
  1. LoadModule vhost_alias_module modules/mod_vhost_alias.so   //去掉前面的#,意思是啟用apache的虛擬機器主機功能,第203行  
[plain] view plain copy 
  1. 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 
  1. <VirtualHost *:80>  
  2. ServerAdmin [email protected]  
  3. DocumentRoot "D:\softlocation\phpstudy\WWW\ecshop" //DocumentRoot後面修改為網站的根路徑  
  4. ServerName www.fangchan.com  //ServerName後面修改為hosts中設定的網域名稱  
  5. ErrorLog "logs/dummy-host2.example.com-error.log  
  6. CustomLog "logs/dummy-host2.example.com-access.log" common  
  7. </VirtualHost>  
4.重啟伺服器,瀏覽器中輸入www.fangchan.com即可訪問 。

 

windows下apache虛擬機器主機的配置

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.