Laravel 和 AngularJS 在 Homestead

Laravel and AngularJS in Homestead

我想开始 Homestead 我的项目。这是一个现有项目,在使用标准 WAMP 堆栈时可以正常工作。

我将后端和前端用作单独的应用程序,但在同一域中,如下所示: Laravel 作为休息后端 url homestead.app/api/public。 AngularJS 作为 url homestead.app/client 的前端。

我已将我的 homestead.app 站点映射到 /home/vagrant/project1,这两个文件夹 api 和客户端位于其中。

尝试访问 homestead.app/api/public 时,我看到了 Laravel 欢迎页面。到目前为止,一切都很好。但是当尝试 homestead.app/api/public/user/info 时,nginx 日志显示缺少 /home/vagrant/project1/index.php。但这是错误的,因为文件位于 /home/vagrant/project1/api/public/index.php.

关于如何将 homestead 用于我的方法的任何建议?

似乎是为 API (api.homestead.app) 使用单独的子域或完全不同的域的好方案。

查看 the documentation 中的 "Adding additional sites" 部分:

Once your Homestead environment is provisioned and running, you may want to add additional Nginx sites for your Laravel applications. You can run as many Laravel installations as you wish on a single Homestead environment. There are two ways to do this: First, you may simply add the sites to your Homestead.yaml file and then run homestead provision or vagrant provision.