我只是在Windows上的xampp中设置virtualhost
。我编辑文件D:\xampp\apache\conf\extra\httpd-vhosts.conf
并添加此
<VirtualHost *:80>
ServerAdmin webmaster@localhost.myproject.com
DocumentRoot "D:\virtualdomain\MyProject"
SetEnv APPLICATION_ENV development
<Directory "D:\virtualdomain\MyProject">
Options Indexes FollowSymLinks Includes ExecCGI
AllowOverride All
Require all granted
</Directory>
ServerName localhost.myproject.com
ErrorLog "localhost.myproject.com"
CustomLog "localhost.myproject.com" common
</VirtualHost>
然后我编辑文件C:\Windows\System32\drivers\etc\hosts
并添加此
127.0.0.1 localhost.myproject.com
在目录D:\virtualdomain\MyProject
内,我创建了一个文件index.php
。但是当我尝试访问http://localhost.myproject.com/index.php
时,它会给我这个错误页面