Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

palaiTB's avatar

How do I deploy Laravel app on any hosting service with Vue in frontend?

Hey guys, I would like to know how to deploy a web app with Laravel as the backend framework and Vue as frontend and mysql as database. I do not want to use Laravel Forge or Vapor since they cost a premium. Is there any other way? Like deploying on Heroku or AWS or Azure?

I have surfed the net and there is not on tutorial that explains how to deploy the same. It's tough and it is urgent. Kindly suggest me some methods!

0 likes
9 replies
cookie_good's avatar

who are you hosting with and is it shared hosting or is it a VM?

cookie_good's avatar

I recommend a VM like Digital Ocean or AWS Ec2. Heroku is overkill for this.

1 like
palaiTB's avatar

I can use digital ocean or Ec2, but how do I configure the vue frontend part? Can you please guide me through?

cookie_good's avatar

Do you already have your vue app written?

Isn't it just

npm install
npm run dev
skoobi's avatar
skoobi
Best Answer
Level 13

If you use Laravel Forge it allows you to run npm when you deploy the code from GitHub. If you have SSH access to the server then you just login and do like what @cookie_good has posted but if its production then its npm run prod.

If you run npm run prod before pushing your code up to the server then it will just work. One issue I did have previously was that the changes I made didn't reflect on the production server, but was due to chrome caching the js and css, so just remember to clear the cache.

palaiTB's avatar

I understand but then again, Laravel Forge is expensive and I don't want to spend that kind of money. Any other suggestion?

skoobi's avatar

If your confident enough working in Linux and SSH, then you can just use git as you would on your localhost.

palaiTB's avatar

Can you suggest some tutorials or articles explaining the same?

cookie_good's avatar
$ sudo su
$ apt install php mysql-server apache2 composer git npm vim
$ cd /var/www
$ git clone https://your.repo
$ cd /var/www/your_repo
$ composer install
[...]
install dependencies
[...]
$ vim .env.example

in the .env.example

do this

APP_DEBUG=false

DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=your_database
DB_USERNAME=your_mysql_username
DB_PASSWORD=your_password

additional dependency that must be installed

$apt install php-mysql

then do this

php artisan key:generate
php artisan migrate
npm install
npm run prod

Oh yeah, very important. 90% of problems with Laravel deployment out of the box can be solved with this.

$ chown -R www-data:www-data .

and remember to exit root.

Please or to participate in this conversation.