Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/laravel/11.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
laravel虚拟主机安装程序未显示前端_Laravel_Apache_Localhost - Fatal编程技术网

laravel虚拟主机安装程序未显示前端

laravel虚拟主机安装程序未显示前端,laravel,apache,localhost,Laravel,Apache,Localhost,我有一台新的笔记本电脑,现在正在尝试运行laravel应用程序。 首先,我正在尝试为项目设置一个虚拟主机,以便访问blog.local 我打开了我的主机文件,并按如下方式设置了驱动程序: 127.0.0.1 localhost 127.0.0.1 test.local 127.0.0.1 blog.local <VirtualHost *:80> DocumentRoot "C:\XAMPP\htdocs" ServerName

我有一台新的笔记本电脑,现在正在尝试运行laravel应用程序。 首先,我正在尝试为项目设置一个虚拟主机,以便访问blog.local

我打开了我的主机文件,并按如下方式设置了驱动程序:

127.0.0.1       localhost
127.0.0.1       test.local
127.0.0.1       blog.local
<VirtualHost *:80>
    DocumentRoot "C:\XAMPP\htdocs"
    ServerName localhost
</VirtualHost>


<VirtualHost *:80>
    DocumentRoot "C:\XAMPP\htdocs\blog"
    ServerName blog.local
</VirtualHost>
对于apache配置,我有以下内容:

127.0.0.1       localhost
127.0.0.1       test.local
127.0.0.1       blog.local
<VirtualHost *:80>
    DocumentRoot "C:\XAMPP\htdocs"
    ServerName localhost
</VirtualHost>


<VirtualHost *:80>
    DocumentRoot "C:\XAMPP\htdocs\blog"
    ServerName blog.local
</VirtualHost>

DocumentRoot“C:\XAMPP\htdocs”
服务器名本地主机
DocumentRoot“C:\XAMPP\htdocs\blog”
ServerName blog.local
当我尝试访问我的url时,我看不到网站,只看到文件:


对于本项目和未来的项目,我如何创建本地url并在访问它时查看前端?

您需要对公用文件夹进行寻址

<VirtualHost *:80>
    DocumentRoot "C:\XAMPP\htdocs\blog\public"
    ServerName blog.local
</VirtualHost>

DocumentRoot“C:\XAMPP\htdocs\blog\public”
ServerName blog.local

文档根目录是一个目录(文件夹),存储在主机服务器上,指定用于保存网页。当其他人查看您的网站时,这是他们将访问的位置

根据您的PHP项目所在地,将
DocumentRoot
更改为

<VirtualHost *:80>
    DocumentRoot "C:/xampp/htdocs/blog/public"
    ServerName blog.local
</VirtualHost>

DocumentRoot“C:/xampp/htdocs/blog/public”
ServerName blog.local

进行任何更改后重新启动服务器!如果不重置服务器以应用更改,则即使您知道自己做的一切都是正确的,也不会有任何效果

更正DocumentRoot路径,应指向公共目录,并尝试重新启动Apache服务器。