为什么我得到的是 Apache2 欢迎页面而不是 laravel 页面?



我通过homestead安装了laravel,但是当我去localhost时,我得到了apache2欢迎/成功屏幕。我无法加载Laravel欢迎页面。

我在宅基地箱子上流浪,但没有拉拉维尔文件。所以我使用composer create-project --prefer-dist laravel/laravel app安装了它。

现在,当我转到localhost时,我会看到apache2欢迎屏幕。如果我在/vagrant中放一个index.html,我可以通过去localhost:8000来加载它。但是,在没有索引文件的情况下转到同一地址会导致 403。

我已经尝试了 URL 的所有组合,/app、/app/app、/app/public,并且我尝试更改 .env 中的 URL。

奇怪的是,我在服务器上找不到这个 apache 欢迎文件。页面本身说"你应该替换这个文件(位于/var/www/html/index.html)"如果我 SSH 进入并转到该文件夹,那里有一个 nginx 欢迎 html 页面,但没有 apache 页面。

如果我在浏览器中转到 file:///var/www/html/,我会看到 apache 欢迎页面的索引.html。如果我去 file:///var/我在那里看到几个不同的文件夹,而不是通过SSH进入流浪者盒子。我不明白为什么。

如何显示拉拉维尔欢迎页面?

编辑:

http://localhost:8000/public 返回"未指定输入文件">

家园的一部分.yaml

sites:
-
map: homestead.test
to: /home/w/work/qs/app/public

/etc/hosts:

127.0.0.1       localhost
127.0.1.1       qs      qs
192.168.10.10   homestead.test
# The following lines are desirable for IPv6 capable hosts
::1     localhost ip6-localhost ip6-loopback
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
#### HOMESTEAD-SITES-BEGIN
# 127.0.0.1     homestead.test
#### HOMESTEAD-SITES-END

您需要为每个站点添加主机条目以及到Homestead.yaml的映射:

/etc/hosts:

192.168.10.10    homestead.test

~/Homestead/Homestead.yaml:

sites:
- map: homestead.test
to: /home/vagrant/code/my-project/public

然后还在~/Homestead下,运行vagrant up --provision

根据文档,

you will still need to add an  /etc/hosts file entry for homestead.test or the domain of your choice if you are not using automatic 

/etc/hosts文件中添加域条目,例如:

192.168.10.10  homestead.test

并尝试从浏览器 http://homestead.test 眉毛

确保列出的IP地址是在您的Homestead.yaml中设置的IP地址

已编辑:似乎您可能会在项目的根目录中运行一些命令。

这是验证您的步骤的非常短的视频。

https://youtu.be/a9jtoXXp5ao

万事如意!

最新更新