xampp 添加虚拟主机站点

时间:2021-11-18 11:01:03

1、去掉httpd.config里面  Include conf/extra/httpd-vhosts.conf  前面的##

2、在vhosts.config里添加虚拟站点

<VirtualHost *:80>
    DocumentRoot "E:\www"
    ServerName app.local.com
    <Directory "E:\www">  
	Options FollowSymLinks IncludesNOEXEC Indexes
	DirectoryIndex index.php index.html index.shtml
	AllowOverride None
	Order Deny,Allow
	Allow from all
    </Directory>
</VirtualHost>

3、在C盘的host文件中添加对应的站点

  127.0.0.1  app.local.com

4、浏览器访问,如果报

Access forbidden!

就在httpd.confg最后添加如下内容:

  

<Directory "E:\www">  
    Options Indexes FollowSymLinks Includes ExecCGI  
    AllowOverride All  
    Require all granted  
</Directory>