在httpd.conf文件中配置一臺www.sohu.cn的虛擬主機,而後在window系統中註冊www.sohu.cn這臺主機。php
在httpd.conf 文件中啓用 httpd-vhosts.confhtml
就是把#註銷掉web
# Virtual hosts ,虛擬主機windows
Include conf/extra/httpd-vhosts.confide
假設咱們的虛擬主機在 f:/myweb 盤 [該站點,事先有]spa
設置http-vhosts.conf文件htm
#配置咱們本身的虛擬主機blog
<VirtualHost127.0.0.1:80>ip
DocumentRoot "d:/myblog"get
#這裏配置歡迎首頁面
DirectoryIndex index.html index.htmindex.php
<Directory />
Options FollowSymLinks
#不準可別人修改咱們的頁面
AllowOverride None
#設置訪問權限
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
4. 在hosts文件中添加咱們的ip 和主機映射關係
c:/windows/system32/drivers/etc/hosts
127.0.0.1 www.sohu.cn