Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

HilbertInvest's avatar

How to add multiple site for a Laravel Forge Project

Hi I created a project and site for a client, and now they want a new subdomain. So how can I add another site to the same Laravel Forge project? Now I created site1.abc.com but they want site2.abc.com

What is the best solution for me to solve this problem? I would appreciate it.

Sarder

0 likes
2 replies
LaryAI's avatar
Level 58

To add a new subdomain to an existing Laravel Forge project, you can follow these steps:

  1. Log in to Laravel Forge: Go to the Laravel Forge website and log in to your account.

  2. Select the Server: Choose the server where your project is hosted.

  3. Add a New Site:

    • Click on the "Sites" tab in the server dashboard.
    • Click the "Create Site" button.
    • In the "Domain" field, enter the new subdomain (e.g., site2.abc.com).
    • Choose the appropriate project type (e.g., "PHP/Laravel").
    • Configure any other settings as needed (e.g., web directory, PHP version).
  4. Deploy the Site:

    • After creating the site, you may need to deploy your code to the new subdomain. This can be done by setting up a deployment script or manually copying the necessary files.
    • If you are using a version control system like Git, you can set up a deployment script in the "Deploy Script" section of the new site.
  5. Configure DNS:

    • Ensure that the DNS settings for your domain (abc.com) include an A record or CNAME record for the new subdomain (site2.abc.com) pointing to your server's IP address.
  6. SSL Certificate (Optional but recommended):

    • If you want to secure the new subdomain with HTTPS, you can use Laravel Forge to provision an SSL certificate.
    • Go to the "SSL" tab for the new site and click "Obtain Certificate" to get a free Let's Encrypt certificate.

Here is a step-by-step example of how to create a new site in Laravel Forge:

  1. Log in to Laravel Forge and select your server.

  2. Navigate to the "Sites" tab and click "Create Site".

  3. Fill in the details:

    • Domain: site2.abc.com
    • Project Type: PHP/Laravel (or whatever is appropriate for your project)
    • Web Directory: public (if using Laravel)
    • PHP Version: Select the version you are using
  4. Click "Create Site".

  5. Set up deployment:

    • If using Git, configure the repository and branch in the "Deploy Script" section.
    • Example deploy script:
    cd /home/forge/site2.abc.com
    git pull origin main
    composer install --no-interaction --prefer-dist --optimize-autoloader
    php artisan migrate --force
    
  6. Configure DNS:

    • Add an A record or CNAME record for site2.abc.com pointing to your server's IP address.
  7. Obtain an SSL Certificate (optional):

    • Go to the "SSL" tab for site2.abc.com.
    • Click "Obtain Certificate" and follow the prompts to get a Let's Encrypt certificate.

By following these steps, you can successfully add a new subdomain to your existing Laravel Forge project.

Please or to participate in this conversation.