Laravel php artisan serve 日志存储并自动启动 artisan serve

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/34097654/
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

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-14 12:46:35  来源:igfitidea点击:

Laravel php artisan serve logs stored and start artisan serve automatically

laravelartisan

提问by Jimmy Obonyo Abor

id like to know :

我想知道 :

  1. Where Laravel php artisan servecommand logs stored ?
  2. How to automatically start php artisan servewhen sever (Apache) starts ?
  1. Laravelphp artisan serve命令日志存储在哪里?
  2. php artisan serve服务器(Apache)启动时如何自动启动?

采纳答案by Jimmy Obonyo Abor

To the first question

对于第一个问题

Where Laravel php artisan serve command logs stored ?

Laravel php artisan serve 命令日志存储在哪里?

Laravel server logs are stored in storage/logsfolder ,which contains files for the server logs

Laravel 服务器日志存储在storage/logs文件夹中,其中包含服务器日志文件

To the second question

对于第二个问题

How to automatically start php artisan serve when sever (Apache) starts ?

如何在服务器(Apache)启动时自动启动 php artisan serve?

If you need to automatically ,A very simple way to do this would be to use use laravel scheduling Artisan Commands using cron

如果你需要自动,一个非常简单的方法是使用 laravel 使用 cron 调度 Artisan 命令

  1. Ensure cron is installed yum install vixie-cron(assuming you use centos). Start it with service crond start
  2. Add laravel Schedule object vi /etc/crontaband add * * * * * php /path/to/artisan schedule:run 1>> /dev/null 2>&1,to the cron schedule file .
  3. Go to app/Console/Kernel.php file and add $schedule->command('foo')->withoutOverlapping();where foo is the artisan command you would like to run in this case serve, so it should be $schedule->command('serve')->withoutOverlapping();

  4. Restart cron deamon with service crond restart.

  1. 确保安装了 cron yum install vixie-cron(假设您使用 centos)。开始吧service crond start
  2. 添加 Laravel Schedule 对象vi /etc/crontab并将 , 添加 * * * * * php /path/to/artisan schedule:run 1>> /dev/null 2>&1到 cron 计划文件中。
  3. 转到 app/Console/Kernel.php 文件并添加$schedule->command('foo')->withoutOverlapping();其中 foo 是您要在这种情况下运行的工匠命令serve,所以它应该是$schedule->command('serve')->withoutOverlapping();

  4. 重新启动 cron 守护进程service crond restart

See this related question https://stackoverflow.com/a/34096590/1226748

请参阅此相关问题https://stackoverflow.com/a/34096590/1226748

回答by Mina Abadir

  1. Laravel logs are stored at storage/logs
  2. You don't need artisan serve, if you have Apache handling your HTTP traffic.
  1. Laravel 日志存储在 storage/logs
  2. artisan serve如果您让 Apache 处理您的 HTTP 流量,则不需要。

回答by PatrickCurl

I would definitely recommend NOT using artisan's server in production like EVER, it's for testing only. -- You would be WAY better off to use nginx as a reverse proxy and you can set whatever port you want that way, and have your angular app still connect to it.

我绝对建议不要像 EVER 那样在生产中使用 artisan 的服务器,它仅用于测试。-- 最好将 nginx 用作反向代理,您可以通过这种方式设置任何您想要的端口,并让您的 angular 应用程序仍然连接到它。