Laravel 如何在生产环境中启动服务器

Laravel how to start server in production

当我运行它输出:

php artisan serve --port=80
Laravel development server started on http://localhost:80

如何在后台运行 运行,当我退出控制台时服务器停止。

简短回答:不要

网络服务器 artisan 使用的是 PHP built-in 网络服务器,除了 Built-in web server 文档:

Warning This web server was designed to aid application development. It may also be useful for testing purposes or for application demonstrations that are run in controlled environments. It is not intended to be a full-featured web server. It should not be used on a public network.

The web server runs a only one single-threaded process, so PHP applications will stall if a request is blocked.

在生产环境中,您应该使用功能齐全的 Web 服务器,例如 nginx, Apache, lighttpd