skip to Main Content

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


  1. 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!

    Login or Signup to reply.
  2. for Nuxt, added your script in package.json

      "scripts": {
    
        "dev:host": "nuxt --host 'IP-Address' --port 3001",
    }
    

    Run:

    dev:host": "nuxt --host 'IP-Address' --port 3001
    

    For Laravel:

     php artisan serve --host=IP-Address  --port=8001
    

    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.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search