当使用 lsapp.test (httpd-vhosts + .hosts) 时,我的 Laravel 项目将变成 wamp 主页
My Laravel project is going to wamp homepage when using lsapp.test (httpd-vhosts + .hosts)
我正在尝试使用域 lsapp.test
在 wamp 中访问我的 Laravel 项目。我可以使用 localhost/lsapp/public
正常访问该站点,但是当我使用上面的方法时,我会被发送到 wamp 主页。
这是 Wamp 版本 3.1.3 和 Apache 2.4.33,PHP 7.2.4。这是我的 httpd-vhosts 文件。
<VirtualHost *:80>
ServerName localhost
ServerAlias localhost
DocumentRoot "${INSTALL_DIR}/www"
<Directory "${INSTALL_DIR}/www/">
Options +Indexes +Includes +FollowSymLinks +MultiViews
AllowOverride All
Require local
</Directory>
</VirtualHost>
<VirtualHost *:80>
DocumentRoot "C:/wamp64/www/lsapp/public/"
ServerName lsapp.test
</VirtualHost>
Windows 主机文件:
127.0.0.1 localhost
::1 localhost
127.0.0.1 lsapp.test
::1 lsapp.test
我搜索了一段时间,但未能找到任何有助于解决此特定问题的信息。
您还应该将 public 路径作为 DirectoryRoot。这是格式。
<VirtualHost *:80>
ServerAdmin webmaster@localhost
DocumentRoot "C:/wamp64/www/lsapp/public"
ServerName lsapp.test
ServerAlias *.lsapp.test
<Directory "C:/wamp64/www/lsapp/public">
Options All
AllowOverride All
Require local
</Directory>
</VirtualHost>
编辑:设置vhosts后重启Apache服务器生效
我正在尝试使用域 lsapp.test
在 wamp 中访问我的 Laravel 项目。我可以使用 localhost/lsapp/public
正常访问该站点,但是当我使用上面的方法时,我会被发送到 wamp 主页。
这是 Wamp 版本 3.1.3 和 Apache 2.4.33,PHP 7.2.4。这是我的 httpd-vhosts 文件。
<VirtualHost *:80>
ServerName localhost
ServerAlias localhost
DocumentRoot "${INSTALL_DIR}/www"
<Directory "${INSTALL_DIR}/www/">
Options +Indexes +Includes +FollowSymLinks +MultiViews
AllowOverride All
Require local
</Directory>
</VirtualHost>
<VirtualHost *:80>
DocumentRoot "C:/wamp64/www/lsapp/public/"
ServerName lsapp.test
</VirtualHost>
Windows 主机文件:
127.0.0.1 localhost
::1 localhost
127.0.0.1 lsapp.test
::1 lsapp.test
我搜索了一段时间,但未能找到任何有助于解决此特定问题的信息。
您还应该将 public 路径作为 DirectoryRoot。这是格式。
<VirtualHost *:80>
ServerAdmin webmaster@localhost
DocumentRoot "C:/wamp64/www/lsapp/public"
ServerName lsapp.test
ServerAlias *.lsapp.test
<Directory "C:/wamp64/www/lsapp/public">
Options All
AllowOverride All
Require local
</Directory>
</VirtualHost>
编辑:设置vhosts后重启Apache服务器生效