我希望能够同时在不同的标签/端口上提供多个laravel应用程序,这样我就可以展示各种设计,遗憾的是,当我运行php工匠服务时,我只能在端口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条答案
按热度按时间z9gpfhce1#
使用php artisan serve --port ='YOUR-PORT'命令。
或
可以在.env文件中创建变量SERVER_PORT
示例:
ghg1uchk2#
当你运行
php artisan serve
时,你可以添加--port ####
,如下所示:php artisan serve --port 8001
,这将在端口8001上运行项目w7t8yxp53#
你可以使用Laravel Valet,你基本上有每个网站的本地域名,我每天都在MacOS上使用它,如果你在Windows上,这应该会有帮助:
https://github.com/cretueusebiu/valet-windows
ws51t4hk4#
运行
php artisan serve --port port_number
这将在您定义的端口上运行您的项目。