更新时间:2023-02-24 13:41:34
hosts文件应如下所示,以便可以在IPV4和IPV6网络上找到它
The hosts file should look like this so that it can be found on the IPV4 and IPV6 networks
127.0.0.1 localhost dev.app
::1 localhost dev.app
如果您使用的是Apache 2.4.x,则httpd-vhosts.conf中的这一行
If you are using Apache 2.4.x this line in httpd-vhosts.conf
NameVirtualHost *:80
不再是Apache 2.4所必需或允许的.
is no longer required or allowed for Apache 2.4.
vhost文件应如下所示,混合了Apache 2.2和2.4语法,并且只要激活了mod_access_compat
,就可以允许使用两者,但不要混合使用它们,并且2.4语法更好.您还错过了一些其他有用的点点滴滴
The vhost file should look like this, you mixed Apache 2.2 and 2.4 syntax and while either is allowed as long as you have mod_access_compat
activated, you should not mix them and the 2.4 syntax is better. You also missed a few other useful bits and pieces
<VirtualHost *:80>
DocumentRoot "F:/xampp/htdocs/"
ServerAdmin admin@localhost
ServerName localhost
<Directory "F:/xampp/htdocs/">
Options Indexes FollowSymLinks
AllowOverride all
Require local
</Directory>
</VirtualHost>
<VirtualHost *:80>
DocumentRoot "F:/xampp/htdocs/dev/public"
ServerAdmin admin@localhost
ServerName dev.app
ServerAlias www.dev.app
<Directory "F:/xampp/htdocs/dev/public">
AllowOverride All
Options Indexes FollowSymLinks
Require local
# if you want access from other pc's on your local network
#Require ip 192.168.1
# Only if you want the world to see your site
#Require all granted
</Directory>
</VirtualHost>