I have Laravel installed on a WebServer, but every time I need to test a page I have to type in the terminal: php artisan serves --host = IP_DO_SERVIDOR.
How do I start Laravel together with WebServer ?
I have Laravel installed on a WebServer, but every time I need to test a page I have to type in the terminal: php artisan serves --host = IP_DO_SERVIDOR.
How do I start Laravel together with WebServer ?
To run a script when starting Ubuntu, you can use a cronjob (there are other ways, this one I find easier).
To do this, create a file with the command you want, and put the .sh
extension. In this case, you can create in your home ( /home/[usuario]
) a file named laravel_start.sh
and include php artisan serve --host=IP_DO_SERVIDOR
in it. After saving, run the following command:
chmod +x /home/[usuario]/laravel_start.sh
This gives you permission to run the file.
Then, run:
crontab -e
This will open the task file of cron
, probably in nano
. Go to the end of the file and put the following line:
@reboot /home/[usuario]/laravel_start.sh
Save the file and exit by pressing ctrl+x
and confirming the change.
Boot and see if it starts right.