一、打開Apache配置文件httpd.confphp
二、啓用httpd-vhosts.conf(去掉Include conf/extra/httpd-vhosts.conf前面的註釋)html
三、而後編輯httpd-vhosts.conf(在D:\wamp\bin\apache\Apache2.2.21\conf\extra\)apache
四、配置虛擬主機ide
<VirtualHost *:80>
DocumentRoot "D:/wamp/www/weibo/weibo" #網站目錄,若是在www目錄下的php目錄,下面就填寫F:/www/php ServerName myweibo.com #域名 DirectoryIndex index.html index.htm index.php #默認主頁 <Directory /> Options FollowSymLinks AllowOverride None #不容許別人修改咱們的頁面 order allow,deny #設置訪問權限 Allow from all </Directory> </VirtualHost>
五、修改本機C:\Windows\System32\drivers\etc\hosts文件,添加網站
127.0.0.1 myweibo.com