使用php artisan serve在本地主机上服务多个laravel应用

时间:2019-05-24 00:30:05

标签: php laravel

我希望能够在不同的选项卡/端口上同时提供多个laravel应用,因此我可以展示各种设计,但不幸的是,当我运行php artisan服务时,我只能运行一个应用一次在端口8000上。

即使在更新为laravel 5.8之后,仍会形成文档:

Artisan Serve Improvements
In previous releases of Laravel, Artisan's serve command would serve your application on port  8000. If another serve command process was already listening on this port, an attempt to serve a second application via serve would fail. Beginning in Laravel 5.8, serve will now scan for available ports up to port 8009, allowing you to serve multiple applications at once.

有什么我想念的吗?

4 个答案:

答案 0 :(得分:1)

您可以为此使用Laravel Valet,基本上每个站点都有本地域,如果您在Windows上,我每天都在MacOS上使用它,这应该有所帮助:

https://github.com/cretueusebiu/valet-windows

答案 1 :(得分:1)

您可以像这样运行--port ####时添加php artisan serve

php artisan serve --port 8001,这将在端口8001上运行您的项目

答案 2 :(得分:1)

使用php artisan serve --port ='YOUR-PORT'命令。

答案 3 :(得分:0)

运行php artisan serve --port port_number,这将在您定义的端口上运行您的项目。