【发布时间】:2019-06-02 01:28:16
【问题描述】:
我有一台新笔记本电脑,现在正在尝试运行 laravel 应用程序。 首先,我正在尝试为项目设置一个虚拟主机,以便我可以访问 blog.local
我去了我的主机文件并设置了如下驱动程序:
127.0.0.1 localhost
127.0.0.1 test.local
127.0.0.1 blog.local
对于 apache 配置,我有以下内容:
<VirtualHost *:80>
DocumentRoot "C:\XAMPP\htdocs"
ServerName localhost
</VirtualHost>
<VirtualHost *:80>
DocumentRoot "C:\XAMPP\htdocs\blog"
ServerName blog.local
</VirtualHost>
当我尝试访问我的网址时,我看不到该网站,而只看到文件:
对于这个和未来的项目,我如何创建一个本地 url 并在访问时看到前端?
【问题讨论】:
-
更正DocumentRoot路径,应该指向公共目录并尝试重启Apache服务器。