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

标签 php laravel command-line-interface

当我运行它时输出:

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

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

最佳答案

简答:不要

Web 服务器 artisan 使用的是 PHP 内置 Web 服务器,它不用于除开发以外的任何场景,正如来自 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

关于php - Laravel 如何在生产环境中启动服务器,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34978857/

相关文章:

Angular CLI 在同一文件夹错误中创建文件

PHP - 将日期放入 MySQL 表

php - Codeigniter:您提交的 URI 包含不允许使用的字符

php 7.4 xampp 尝试访问 null 类型值的数组偏移量

php - Laravel背包关系疑惑

linux - 如何在 Linux 中操作重启一个 bash shell 脚本

php - 在 mysql 和 PHP 中搜索特殊字符

php - 如何在wordpress中获取img标签的图片url

php - Laravel:我们可以在以前的版本中使用最新版本的服务吗

ftp - linux mput 命令选项