Report this

What is the reason for this report?

How to deploy Vue and Laravel Apps to Droplet

Posted on January 27, 2021

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?



This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

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.

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

The developer cloud

Scale up as you grow — whether you're running one virtual machine or ten thousand.

Get started for free

Sign up and get $200 in credit for your first 60 days with DigitalOcean.*

*This promotional offer applies to new accounts only.