apache虚拟目录和虚拟主机的设置

配置虚拟目录


修改httpd.conf

1.增加模块

<IfModule dir_module>
    DirectoryIndex index.php index.html index.htm
    Alias /www  "D:/www"
    <Directory D:/www>
    Order allow,deny
    Allow from all
    </Directory>
</IfModule>


2.注释DocumentRoot "C:/AppServ/www"

3.重启apache


配置虚拟主机

修改httpd.conf

1.启用  虚拟主机 Include conf/extra/httpd-vhosts.conf

2.打开  extra/httpd-vhosts.conf 增加虚拟模块

  <VirtualHost 127.0.0.1:80>
    DocumentRoot "D:/www"
    DirectoryIndex index.php index.html index.htm
    <Directory />
    options FollowSymLinks
    AllowOverride None
    Order allow,deny
    Allow from all
    </Directory>
</VirtualHost>

3.修改hosts

127.0.0.1  www.xxx.com

4.重启apache




發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章