Site Setup

Requires a server to be provisioned.

Resources used

Steps

  1. Delete the default site by clicking the site named "default", and on the page that loads, clicking "Delete Site". imageimage
  2. You'll be redirected back to the server's sites page where it'll show you a form to create a new site.
  3. Fill out the form with the site details. image
    • Root domain: The desired domain name.
      • Note: We generally prefix these with www. unless otherwise specified.
    • Project Type: PHP/Laravel/Symfony
    • Aliases: We can set this if we want to test the server and site setup before actually updating DNS.
      • If we want to test this, we can set this to -.fosterstaging.com, for example, fostercommerce-production.fosterstaging.com.
    • Web directory: /web
    • PHP Version: 8.3, or the highest supported version of the site.
    • Leave all toggles off.
  4. Click "Add Site".
  5. You'll be taken to the sites dashboard. We'll be using deployments from GitHub Actions, so there is nothing left to do here.
  6. If you've already connected the domain or the alias to the site's IP, then you'll see the default Forge page by navigating to the site.
  7. Once deployments are setup and working, you'll need to remove the default Forge page because Nginx gives it priority over the index.php file added by CraftCMS. To do that, remove the file:
    ssh forge@<server>
    rm ~/<site host>/web/index.html
    

Environment Variables

If you've set up a new site, there won't be any environment variables pre-set. image

If you're moving a site to a new server - copy the original environment variables over to the new sites environment variables, and make any relevant updates, notably to the database config.

If you're setting a up a new site - set the environment variables based on the sites requirements.

Note that if you're using the fosterstaging domain to test that things are working, ensure that the SITE_URL or CRAFT_SITE_URL are set to that domain and not the primary site domain that's configured in Forge.