How to deploy Laravel as backend and Nextjs as front end in VPS

26 Views Asked by At

I used Laravel as Backend for my project and it works properly in my VPS these are routes reserved for my Laravel

/admin/ //back office
/api/  //for api

I ran Nextjs locally very good with port 3000 but I want to run Nextjs as frontend application with many problems

When I ran this command it returned this error:

npm run build
npm run start
Error: listen EADDRINUSE: address already in use :::80

Also I mapped my httpd vhost to /var/www/html/laravel-app/ which this directory placed Laravel files and /var/www/html/next-app/ placed Next.js file

Finally I want these routing work properly:

  1. example.com/admin laravel
  2. example.com/api Laravel
  3. example.com/products Next.Js
0

There are 0 best solutions below