Back

deploying laravel to production


Philip Metzger posted 2 months ago

So locally I run "php artisan serve" which starts the development server. But how would I do this on production? I basically use laravel as the backend for a node.js app. I looked and found this: https://laravel.com/docs/5.7/deployment but it doesnt really say how to start the laravel app.

Any help would be highly welcomed

Pardeeptech replied 2 months ago

Hello ,

Firstly , can you please tell me which hosting server you have ? because some hosting providers don't have ssh access.

On Production you can run same command "php artisan serve" just open ssh terminal and go to website-folder/public_html and type same as locally.

I also suggest you to follow this article steps if you face any problem to deploy your Laravel application.

https://www.cloudways.com/blog/install-features-laravel-5-7/

Alejandro Barrera Aponte replied 2 months ago

Hi,

The serve command is just for a simple dev server, for production it's not even close to being reliable. Depending on your host, you might already have apache/nginx, or might have to set it up from scratch.

Also, Laravel Forge is always a good option.

Best,

Philip Metzger replied 2 months ago

Well to explain it further, I have a git projects with 2 directories.

  1. Frontend - a node app that I deploy with pm2 and route through nginx to the correct port
  2. api - which is the laravel app.

I am no expert in backend configuration so was wondering how could i do the following:

  1. start the laravel app? do i just have to copy the contents to my nginx server sites-available directory?
  2. tell nginx to route to the laravel app? so preferably I do not want to copy the laravel contents to the sites-available but instead point it to my api/ directory.

Sign in to participate in this thread!



We'd like to thank these amazing companies for supporting us