Laravel Forge - multiple sites on the same server

7.1k views Asked by At

I have over the past months tried to learn myself about php/laravel. I have made some laravel hobby apps which i was thinking of putting on a server, so i could use them.

I am using digitalocean for the server and laravel forge for easy deployment.

My problem is that on laravel forge it says that i can add sites, but how do i add more than one site?

There is three fields to fill in: Root Domain, Project Type and Web Directory. What do i type in these fields and how do i access the site afterwards?

1

There are 1 answers

1
Rwd On

Root Domain: This is the domain (web address) that you want to be associated with your site (e.g. example.com).

Project Type: This is the type of application that you're wanting to be hosting. In your case it will be General PHP / Laravel.

Web directory: This is the folder of your app that you want to use as the web root. In your case this should be public/ (unless you've moved/renamed the directory or you've moved you index.php out of that directory which I don't recommend). It is generally good practice to have your web root in a sub directory so that you can easily prevent access to sensitive information by placing it in the root directory or you app.

With a Laravel site you should almost always only have to fill out the root domain field as the rest are set for Laravel by default.

Forge comes with a "default" site set up so that you can access your site with just your ip address of the server, however, if/once you've got your domain it is recommended that you delete this and then add your site/app with the domain.

To add another site you would just need to:

  1. Point the A record of your domain to the IP address of your forge server
  2. Fill out the form for adding a new site (in Forge)
  3. On the next page set up forge to pull your app from your git repo.

This tutorial should give you a quick overview: https://laracasts.com/series/server-management-with-forge/episodes/13 It is part of a series should you want/need more information but please note that some of the videos are over 2 years old so some minor things might be a bit different.

Hope this helps!