wamp虛擬主機配置

一、首先打開apache的配置文件httpd.conf,並去掉#Include conf/extra/httpd-vhosts.conf前面的#,啓用虛擬主機功能 php

二、先把localhost配置好,省得之後訪問localhost出現問題,個人wamp項目根目錄是D:\wamp\www。將下面信息添加到apache的apache/conf/extra下的配置文件httpd-vhosts.conf後面便可; apache

<VirtualHost *:80>
        DocumentRoot "D:/wamp/www"
        ServerName localhost
        <Directory "D:/wamp/www">
            Options Indexes FollowSymLinks
            AllowOverride None
            Order allow,deny
            Allow from all
        </Directory>
</VirtualHost> ide

三、配置其餘項目虛擬主機:好比配置www.zf.com,打開該連接便可直接訪問D:/wamp/www/zf/public目錄。「DirectoryIndex index.php」的意思是訪問該目錄默認打開「index.php」文件 get

<VirtualHost *:80>
        DocumentRoot "D:/wamp/www/zf/public"
        ServerName www.zf.com
        DirectoryIndex index.php
        <Directory />
            Options Indexes FollowSymLinks
            AllowOverride None
            Order allow,deny
            Allow from all
        </Directory>
</VirtualHost> io

四、修改C:\Windows\System32\drivers\etc下的host文件,用記事本打開,添加 127.0.0.1       www.zf.com  ,重啓apache便可配置

相關文章
相關標籤/搜索