Windows apache虛擬主機配置


1.記事本打開hosts文件,文件在:C:\ Windows\ System32\ drivers\etc 文件夾下, 在文件內容的末尾寫入:

1 127.0.0.1(不可改) www.test.com(自定義)

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

1 LoadModule vhost_alias_module modules/mod_vhost_alias.so   //去掉前面的#,意思是啟用apache的虛擬主機功能

3.記事本打開httpd-vhosts.conf文件,該文件在apache的目錄下,如:D:\AppServ\ Apache2.2\conf\extra,按照文件中原有的格式再添加一個VirtualHost,只修改下面有注釋的兩處,如下:

1 <VirtualHost *:80>  
2 ServerAdmin webmaster@dummy-host2.example.com  
3 DocumentRoot "/htdocs/www" //DocumentRoot后面修改為網站的根路徑  
4 ServerName www.test.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.重啟apache,地址欄訪問www.test.com即可.



 




免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM