apache 虛擬主機配置過程 php

1配置apache支持虛擬主機。這一步很重要。apache

#Include conf/extra/httpd-vhosts.confwindows

找到 上面相關文本,去掉#Include conf/extra/httpd-vhosts.conf前的#。ide

保存退出spa

2編輯conf目錄下extra文件夾下的httpd-vhosts.conf。如例子所示.net

<VirtualHost *:80>get

    ServerAdmin 8@1.comio

    DocumentRoot "D:/Web/apache/htdocs"配置

    ServerName www.gs.cn:80im

    ServerAlias www.gs.cn:80error

    ErrorLog "logs/error.log"

    CustomLog "logs/access.log" common

</VirtualHost>

 

<VirtualHost *:80>

    ServerAdmin kuhool.com

    DocumentRoot "F:/Web1"

    ServerName www.kuhool.com

    ErrorLog "logs/error.log"

    CustomLog "logs/access.log" common

    <Directory "F:/Web1">

    AllowOverride None

    Options Indexes FollowSymLinks

    Order allow,deny

    Allow from all

    </Directory>

</VirtualHost>

3編輯本地host文件,以windows爲例

進入C:/Windows/System32/drivers/etc

記事本打開hosts文件

最後添加

 127.0.0.1      localhost

 127.0.0.1      www.kuhool.com

4注意 若是報403錯誤 請針對他作修改

<Directory "F:/Web1">

    AllowOverride None

    Options Indexes FollowSymLinks

    Order allow,deny

    Allow from all

    </Directory>

</VirtualHost>

相關文章
相關標籤/搜索