Deploy a Laravel and Vue.js web app

This is a guide to deploying a web application with a Laravel backend and a JavaScript-based frontend on a dedicated or virtual private server.

The articles are listed in order below; you can read more meta-information about the guide below the table of contents.


  1. Preliminary server setup: standard first steps on a fresh Linux server.
  2. Install PHP: install PHP and required PHP extensions for running Laravel.
  3. Database setup: install a database management system (MySQL, PostgreSQL, or SQLite) and create a database and database user if required by your DBMS.
  4. Server-side Git setup: set up a Git repo and create a post-receive hook.
  5. Development-side Git setup: connect Git on your dev machine and server.
  6. Composer: install Composer and use it to install PHP packages.
  7. Node.js: install Node.js and install your app’s Node.js dependencies.
  8. Laravel environment setup: take care of your .env file, database migrations, and a few pre-deployment optimizations.
  9. Directory permissions: a few ownership and permission tweaks for Laravel to run.
  10. Nginx: install Nginx; create and activate your app’s Nginx config.
  11. Automating deployment: three options for automated redeployment.
  12. Custom domain name: set up DNS records needed for a custom domain name.
  13. HTTPS: set up a free, autorenewing HTTPS certificate with Certbot.


What’s this?

A guide to deploying a web application with a Laravel backend and JavaScript-based frontend (e.g. Vue, React, etc.) on a dedicated or virtual private server. My goal in writing this was to document the process for future reference and help anyone else doing the same thing.

Tech stack

  • Server: either a virtual private server (e.g. a Digital Ocean droplet) or a physical server, running a Debian-based Linux distro (e.g. Debian, Ubuntu).
  • Backend: Laravel
  • Web server: Nginx
  • Database: your choice of MySQL/MariaDB, PostgreSQL, SQLite
  • Frontend: Any JavaScript-based framework (e.g. Vue, React, etc.) for which you could reasonably define an npm run build script. The frontend has a relatively minor role in this guide.


  • You are willing and able to operate in a Linux command line environment.
  • You have root access to a Linux server.
  • You can access the server over SSH and have the basic SSH knowledge required to do so (e.g. generating a public/private keypair; copying your public key to the authorized_keys file on the server; logging in over SSH).


I’ll generally show shell prompts in username@host$ format, and sometimes append the current working directory username@host:cwd$ for clarity:

# You on your development machine
you@dev$ whoami

# A shell command issued as root user on the server
root@server$ whoami

# A shell command issued as laravel user on the server
laravel@server$ whoami

# A shell command issued as laravel user from home directory
laravel@server:~$ pwd

# A shell command issued as laravel user from /var/www
laravel@server:/var/www$ pwd

Other conventions:

  • I’ll use as a server IP address.
  • I’ll use laravel as the name of the non-root user on your app’s server.
  • I’ll use laravel-project as the name of your project’s root server-side directory.

Feedback, suggestions, etc.

If you have ideas for improving the series, I will quite likely implement them, appreciate your input, and give you a shoutout for your contributions. Feedback is welcome and appreciated.

Shoutouts to readers: many thanks to Nicola Pugliese for offering good ideas on how improve this series.

You can reach me by email at or by opening an issue or pull request at

Want to say thank you?

You could:

  • Send me an email! Seriously, if this material helped you, it will make my day to know. I love hearing from readers, and you’ll almost certainly get a message back from me.

  • Contribute financially. Based on reader input, there are in fact people out there interested in compensating me financially for this guide. That’s awesome—thank you! You can Buy Me a Coffee here.

Below is a list of other great guides to deploying a Laravel app that I’ve found online and taken inspiration from. Each covers the material from a slightly different angle, so you’ll probably get something out of reading all of them.

The original writing and media in this series is licensed under the Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.