简体   繁体   English

php artisan vs apache / nginx用于生产

[英]php artisan vs apache/nginx for production

I just created my portfolio website http://ashishpatel.info using laravel and vue-router, now i wanted to host it on aws ec2-instance, and we can do it in two ways. 我刚刚使用laravel和vue-router创建了我的投资组合网站http://ashishpatel.info ,现在我想将其托管在aws ec2-instance上,我们可以采用两种方式。

1 - using php artisan, 1-使用php artisan,

php artisan serve --host=0.0.0.0 --port=80

2 - using apache/nginx and doing some change in apache2.conf etc. 2-使用apache / nginx并在apache2.conf等文件中进行一些更改

I wonder which is best way for doing it for production for handling more traffic? 我想知道哪种方法最适合生产以处理更多流量?

You should use serve command only for development on the local machine. 您仅应将serve命令用于在本地计算机上进行开发。 Never use it on the production server. 切勿在生产服务器上使用它。

For production, always use web server like nginx, Apache, IIS. 对于生产,请始终使用Web服务器,如Nginx,Apache,IIS。

Artisan is using PHP's buit-in webserver, which currently, can only serve a single connection at a time. Artisan正在使用PHP的内置Web服务器,该服务器目前一次只能提供一个连接。 This is not suitable for production environments. 这不适用于生产环境。

Quoting from the PHP Docs 引用PHP文档

Warning This web server was designed to aid application development. 警告此Web服务器旨在帮助应用程序开发。 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. 它并非旨在成为功能齐全的Web服务器。 It should not be used on a public network. 它不应在公共网络上使用。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM