How to Set Up Laravel Forge, DigitalOcean, and GitHub to Deploy Your Website
If you're having a website built, there's a good chance your developer has recommended a stack involving GitHub, DigitalOcean, and Laravel Forge. These three tools work together to give you a modern, reliable deployment pipeline: your code lives in GitHub, your server runs on DigitalOcean, and Forge acts as the bridge between them — handling server provisioning, deployments, SSL, and more.
This guide walks you through setting up all three accounts and connecting them, step by step. You don't need to be a developer to follow it, but you will want to be comfortable clicking through a few dashboards and managing a couple of API keys. If that sounds like more than you want to take on yourself, this is exactly the kind of setup I handle for clients — just get in touch and we can take care of it.
What you will need
Before you start, make sure you have:
- A GitHub account (this guide assumes you already have one)
- A credit card for DigitalOcean and Laravel Forge (both have low monthly costs)
- About 30 minutes
DigitalOcean frequently offers a free credit promotion for new accounts (currently $200 for 60 days), which is more than enough to get started without being charged anything upfront. Laravel Forge starts at $12/month and covers an unlimited number of servers and sites.
Step 1: Create a DigitalOcean account
DigitalOcean is a cloud hosting provider. Think of it as the physical server your website lives on — the hardware, the network connection, the data center. You rent a virtual server from them on a monthly basis.
- Go to digitalocean.com and click Sign Up.
- You can register with your email address or sign in with GitHub directly — the GitHub option saves a step.
- Verify your email address when prompted.
- Add a payment method. DigitalOcean will not charge you until your free credit runs out, but they require a card on file to activate the account. You'll find this under Billing in your account settings.
- Once your account is active, take a look around the dashboard but don't create anything yet. Forge will handle server creation for you.
Step 2: Generate a DigitalOcean API token
Laravel Forge needs permission to create and manage servers inside your DigitalOcean account on your behalf. You grant that permission through an API token.
- In your DigitalOcean dashboard, click API in the left-hand sidebar.
- Click Generate New Token.
- Give it a recognizable name — something like "Laravel Forge" works fine.
- Make sure both Read and Write scopes are selected.
- Click Generate Token and copy the token immediately. DigitalOcean will only show it once. Paste it somewhere safe temporarily — you will need it in Step 4.
Step 3: Create a Laravel Forge account
Laravel Forge is a server management and deployment tool. It sits on top of your DigitalOcean account and handles the parts that would otherwise require significant server administration knowledge: installing software, configuring web servers, managing deployments, and setting up SSL certificates. If DigitalOcean is the hardware, Forge is the operations team.
- Go to forge.laravel.com and click Create Account.
- Register with your email address and choose a password.
- Select a plan. The Hobby plan at $12/month covers unlimited servers and sites, and is the right starting point for most projects.
- Add your billing information and complete the subscription.
Step 4: Connect DigitalOcean to Forge
Now you will paste that API token into Forge so it can communicate with DigitalOcean.
- In Forge, click your profile icon in the top right and go to Account Settings, then navigate to the Server Providers tab.
- Select DigitalOcean from the list of providers.
- Paste in the API token you generated in Step 2.
- Give the connection a name — "DigitalOcean" is fine — and click Add.
Forge will verify the token. If everything is correct, DigitalOcean will now appear as a connected provider in your account.
Step 5: Connect GitHub to Forge
Forge needs access to your GitHub account so it can pull your code onto the server whenever a deployment is triggered.
- Still in Forge Account Settings, navigate to the Source Control tab.
- Click Connect next to GitHub.
- You will be redirected to GitHub and asked to authorize Laravel Forge. Review the permissions — Forge needs read access to your repositories — and click Authorize.
- You will be redirected back to Forge with GitHub now showing as connected.
Step 6: Provision a server
With both DigitalOcean and GitHub connected, you are ready to create a server. This is where Forge earns its keep — it will spin up a DigitalOcean Droplet (their term for a virtual server), install everything needed to run a PHP application, and configure it securely, all without you touching the command line.
- From the Forge dashboard, click Create Server.
- Select DigitalOcean as the provider.
- Choose App Server as the server type. This installs PHP, Nginx, MySQL, Redis, and other common dependencies for a Laravel application.
- Select a region closest to your expected audience. If your visitors are primarily in North America, New York or San Francisco are reasonable choices.
- Choose a server size. For most small to medium sites, the $12/month Basic plan (1GB RAM, 1 CPU) is sufficient to start. You can scale up later without rebuilding.
- Click Create Server.
Forge will now create the server inside DigitalOcean and run its provisioning scripts. This typically takes five to ten minutes. You will see a progress indicator in the Forge dashboard. Save the root password and the forge user password that Forge displays — you will not see them again.
Step 7: Add a site and connect your repository
Once your server finishes provisioning, you will add a site — which tells Forge the domain name your application will run under, and where on the server files should live.
- Click on your newly provisioned server in the Forge dashboard.
- Under the Sites panel, click New Site.
- Enter your domain name (e.g. example.com). If your DNS is not yet pointed at the server, you can use the server IP address temporarily and update the domain later.
- Select the project type — for Laravel, choose Laravel. For a generic PHP application, choose PHP.
- Click Add Site.
- Once the site is created, navigate to it and click Install Repository.
- Select GitHub as the provider, then choose the repository and branch you want to deploy from — typically main or master.
- Click Install Repository. Forge will clone your code onto the server.
Step 8: Configure your environment and enable deployments
Laravel applications require a .env file with configuration values — your database credentials, application key, mail settings, and so on. Forge provides a place to manage this directly.
- From your site in Forge, click Environment. You will see an editor where you can paste in your .env contents.
- Fill in the appropriate values and click Save.
- Navigate to the Deployments tab and review the deployment script. Forge generates a sensible default — running composer install, migrations, and cache clearing — which works for most Laravel applications out of the box.
- Enable Quick Deploy if you want Forge to automatically deploy every time you push to your connected branch. This is usually the right choice for most projects.
- Click Deploy Now to trigger your first deployment.
Step 9: Add an SSL certificate
Every site should run over HTTPS. Forge makes this trivially easy with Let's Encrypt, a free certificate authority.
- Make sure your domain DNS is pointed at your server IP address before this step. The certificate issuance process requires the domain to resolve to your server.
- From your site in Forge, click SSL. Select Let's Encrypt and enter your domain name.
- Click Obtain Certificate. Forge will request the certificate, install it, and configure Nginx to serve your site over HTTPS automatically.
Once this is done, your site will be accessible at your domain over a secure connection, with your code deploying automatically every time you push a change to GitHub.
What you have built
At this point you have a production-ready deployment pipeline. Your code is version-controlled in GitHub, hosted on a properly configured server on DigitalOcean, managed by Forge, and deploying automatically on every push. It's a setup that scales well, keeps your infrastructure costs predictable, and requires minimal day-to-day maintenance.
This is the same stack I set up for clients. The advantage of having someone do it for you isn't just the time saved — it's having someone who has provisioned dozens of these environments handle the edge cases: configuring queue workers, setting up scheduled tasks, tuning PHP settings for your specific application, and making sure the deployment script actually covers everything your project needs.
If you'd like this set up correctly from the start, or if you've run into a problem somewhere along the way, I'm happy to help.