Trying to fire up a Laravel api and Nuxt app on the actual server by running
lets say server IP is - 10.66.22.41
npm run dev
php artisan serve --port=8001
This obviously worked on my local environment but since this is in the actual server and I am not too familiar with Centos, is there anything I should be doing different?
When I run npm run serve
I get http://localhost:3001/
When I run php artisan serve --port=8001
i get http://127.0.0.1:8001
dumb question:
How should I be accessing this on the browser?
2
Answers
Well, the artisan serve command, will keep the server running until you close the console, which will terminate the service! It is not an ideal setup… I would recommend that you install a webserver of some sort, and install laravel properly via composer. We cannot see how you installed NPM, or if you installed Apache? etc..
I would recommend to install centos webpanel for a starter:
http://centos-webpanel.com/
Then install composer https://linuxize.com/post/how-to-install-and-use-composer-on-centos-7/
Then install laravel using: https://laravel.com/docs/8.x/installation#installing-laravel
This is your best way to manage and run laravel on centos properly (for beginners), if you have the money for it, you should buy CPanel (https://cpanel.net/pricing/) instead of Centos WebPanel, as it offers more flexibility and features.
Good luck!
for Nuxt, added your script in package.json
Run:
For Laravel:
Quick point though, What Khali should be the best practive but if you want to test or whatever you need to do , this is it.