Question

How to deploy Vue and Laravel Apps to Droplet

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?


Submit an answer

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!

Sign In or Sign Up to Answer

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.

Want to learn more? Join the DigitalOcean Community!

Join our DigitalOcean community of over a million developers for free! Get help and share knowledge in Q&A, subscribe to topics of interest, and get courses and tools that will help you grow as a developer and scale your project or business.

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