Laravel 如何在生产中启动服务器
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/34978857/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Laravel how to start server in production
提问by IvRRimUm
When I run it outputs:
当我运行它时输出:
php artisan serve --port=80
Laravel development server started on http://localhost:80
How can I make it run in the background, when I exit the console the server stops.
如何让它在后台运行,当我退出控制台时服务器停止。
回答by Bogdan
Short answer: DON'T
简短回答:不要
The web server artisan
uses is the PHP built-in web server, which is not for use in any scenario other than development as showcased by this excerpt from the Built-in web serverdocumentation:
Web 服务器artisan
使用的是 PHP 内置 Web 服务器,它不用于除开发以外的任何场景,如内置 Web 服务器文档的摘录所示:
WarningThis 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 服务器旨在帮助应用程序开发。它也可用于测试目的或在受控环境中运行的应用程序演示。它不是一个功能齐全的网络服务器。它不应该在公共网络上使用。
Web 服务器仅运行一个单线程进程,因此如果请求被阻止,PHP 应用程序将停止运行。
In production you should be using a fully featured web server such as nginx, Apache, lighttpd, etc.