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
Laravel php artisan serve logs stored and start artisan serve automatically
提问by Jimmy Obonyo Abor
id like to know :
我想知道 :
- Where Laravel
php artisan serve
command logs stored ? - How to automatically start
php artisan serve
when sever (Apache) starts ?
- Laravel
php artisan serve
命令日志存储在哪里? 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/logs
folder ,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 命令
- Ensure cron is installed
yum install vixie-cron
(assuming you use centos). Start it withservice crond start
- Add laravel Schedule object
vi /etc/crontab
and add* * * * * php /path/to/artisan schedule:run 1>> /dev/null 2>&1
,to the cron schedule file . 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 caseserve
, so it should be$schedule->command('serve')->withoutOverlapping();
Restart cron deamon with
service crond restart
.
- 确保安装了 cron
yum install vixie-cron
(假设您使用 centos)。开始吧service crond start
- 添加 Laravel Schedule 对象
vi /etc/crontab
并将 , 添加* * * * * php /path/to/artisan schedule:run 1>> /dev/null 2>&1
到 cron 计划文件中。 转到 app/Console/Kernel.php 文件并添加
$schedule->command('foo')->withoutOverlapping();
其中 foo 是您要在这种情况下运行的工匠命令serve
,所以它应该是$schedule->command('serve')->withoutOverlapping();
重新启动 cron 守护进程
service crond restart
。
See this related question https://stackoverflow.com/a/34096590/1226748
回答by Mina Abadir
- Laravel logs are stored at storage/logs
- You don't need
artisan serve
, if you have Apache handling your HTTP traffic.
- Laravel 日志存储在 storage/logs
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 应用程序仍然连接到它。