-
-
Save WebSofter/4b35957c9bd32327c11b176572fb0577 to your computer and use it in GitHub Desktop.
{ | |
"apps": [{ | |
"name": "laravel-app", | |
"script": "artisan", | |
"args": ["serve", "--host=0.0.0.0", "--port=3333"], | |
"instances": "1", | |
"wait_ready": true, | |
"autorestart": false, | |
"max_restarts": 1, | |
"interpreter" : "php", | |
"watch": true, | |
"error_file": "log/err.log", | |
"out_file": "log/out.log", | |
"log_file": "log/combined.log", | |
"time": true | |
}] | |
} |
1. install Node and PM2 module | |
2. Add file ecosystem.config.json to root folder of laravel project | |
2. Run command: | |
$ pm2 start ecosystem.config.json | |
Hi @WebSofter
Thank you so much for sharing, i use nginx in everything I use and this package and this configuration helped me a lot.
Hi, this option helped me, however sometimes (40% of the time) the pages are loaded without the style, Im using bootstrap.
If I do the php artisan serve this won't happen, any guide with this?
@yefersoncm I think this has something to do with serving none https resources over https website, you need to enable ssl in your octane configuration.
try add OCTANE_HTTPS=true
in your .env
file then run php artisan optimize:clear
.
another work around is to add http --> https redirect in your nginx config
server {
if ($host = YourDomain.com) {
return 301 https://$host$request_uri;
}
}
thankyou, you save my time
cool~
thank you!
Based on this, it was needed to run php artisan serve as sudo, so then i did like this bellow and also worked pretty well.
{ "name": "laravel_serve", "script": "php artisan serve --host=0.0.0.0 --port=80", "instances": "1", "wait_ready": true, "autorestart": false, "max_restarts": 1, "interpreter" : "sudo", "watch": true, "error_file": "log/err.log", "out_file": "log/out.log", "log_file": "log/combined.log", "time": true }
Actually, using the watch feature isn't the best idea: projects are live updated anyways. You should check for the directories you want to exclude: https://pm2.keymetrics.io/docs/usage/watch-and-restart/
Hi @WebSofter,
Thank you for sharing the knowledge, your gist helped me run my Laravel Octane app with Nginx server using proxy,
I have found a cool pm2 command line do the same:
pm2 start artisan --name laravel-worker --interpreter php -- octane:start --server=roadrunner --max-requests=1000 --host=127.0.0.1 --port=8000