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

dfnkt's avatar
Level 1

Laravel Sail / Artisan serve / Apache

Hello all, I recently set up a new Laravel 10 project following the installation directions for Windows/WSL2. Everything was working and I was able to access and do all of my development by going to http://localhost but then I rebooted my computer and after starting Docker back up and doing sail up I now get the default Apache2 Ubuntu page on my localhost URL instead of my Laravel app. Where should I start looking to troubleshoot this?

0 likes
4 replies
LaryAI's avatar
Level 58

It sounds like there might be a conflict with the ports or a misconfiguration in your Docker setup. Here are some steps you can take to troubleshoot the issue:

  1. Check Docker Containers: Ensure that your Laravel Sail container is running. You can check this by running the following command in your terminal:

    docker ps
    

    Look for the container that runs your Laravel application and make sure it's up and running.

  2. Check Port Bindings: When you run docker ps, you'll also see the port bindings for each container. By default, Laravel Sail maps port 80 inside the container to port 80 on your host machine. If you see that the port is not correctly bound, that could be the issue.

  3. Inspect Docker Compose File: Open your docker-compose.yml file and check the ports section under your web server service (it might be named laravel.test or similar). It should look something like this:

    services:
      laravel.test:
        ports:
          - '80:80'
    

    This configuration maps port 80 from the container to port 80 on your host machine.

  4. Check for Other Services on Port 80: It's possible that another service is running on port 80 on your host machine. You can check this by running:

    sudo lsof -i :80
    

    If you find another service is using port 80, you may need to stop that service or change the port binding for your Laravel Sail container to use a different port.

  5. Restart Docker and Sail: Sometimes, simply restarting Docker and Sail can resolve the issue. You can do this by running:

    sail down
    

    And then:

    sail up -d
    
  6. Check Your .env File: Make sure your .env file has the correct APP_URL set, which should match the URL you're trying to access.

  7. Clear Application Cache: Sometimes, the application cache might cause issues. You can clear it by running the following commands:

    sail artisan cache:clear
    sail artisan config:clear
    sail artisan route:clear
    sail artisan view:clear
    
  8. Check Apache2 Configuration: If you have Apache2 installed on your WSL2 instance, it might be starting automatically and taking over port 80. You can check its status with:

    sudo service apache2 status
    

    If it's running, you can stop it with:

    sudo service apache2 stop
    

    To prevent it from starting automatically, you can disable it:

    sudo update-rc.d apache2 disable
    

After going through these steps, try accessing http://localhost again. If you're still facing issues, you may need to provide more details about your Docker configuration and any error messages you're seeing.

1 like
dfnkt's avatar
Level 1

Weird update... after killing all of the apache2 processes everything is working great so it sounds like I just need to set apache2 to not run when the container starts.

Tray2's avatar

@dfnkt You can't have multiple instances of Apache running at the same time, if you have it installed locally on your computer, and you start it on boot, and then try to boot the Sail container then you will get a conflict. So I suggest removing, or at least disabling the autostart of Apache on you windows machine.

You need to decide which you want to use, a local wamp stack, or a docker image for you dev environment.

taylor5392's avatar

I was using WSL2 and docker for my Laravel Sail setup and had the same problem showing the default Apache page. It was because WSL2 had Apache2 installed pre-installed. I removed it with sudo apt remove apache2 and it was resolved.

Please or to participate in this conversation.