Question

How to deploy Vue and Laravel Apps to Droplet

Posted January 27, 2021 2.4k views
NginxVue.jsLaravel

I have a Laravel App and separate Vue app that I want to deploy to a Droplet. I have not combined Vue into the Laravel app. I know how to setup Laravel on the server and get that running but how can I setup Nginx Blocks and the Vue app so that when a someone visits the domain name they are taken to the Vue app?

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

×
Submit an Answer
1 answer

Hi there,

What you could do is first set up your server and deploy your Laravel application as per this tutorial here:

https://www.digitalocean.com/community/tutorials/how-to-install-and-configure-laravel-with-nginx-on-ubuntu-20-04

If you have a domain name you could use something like api.example.com as the server_name.

Once your Laravel application has been deployed, you can create a new directory at /var/www/example.com and upload your VueJS project there. After that, you can create a new Nginx server block for your main domain and use example.com as the servername and change the document root to /var/www/example.com.

That way when you visit api.example.com you will reach your Laravel installation and when you visit example.com you will be seeing your VueJS application thanks to the separate Nginx server blocks.

Regards,
Bobby

by Erika Heidi
Laravel is an open-source PHP framework that provides a set of tools and resources to build modern PHP applications. With a complete ecosystem leveraging its built-in features, Laravel's popularity has grown rapidly in the past few years, with many developers adopting it as their framework of choice for a streamlined development process. In this guide, you'll install and configure a new Laravel application with Nginx and MySQL 8 on an Ubuntu 20.04 server.