9

Hello there we am currently developing a Laravel application. I want all my team members to work locally so we decided to use Docker for our local development environment. I did a little research and there is a project called laradock. After installing it I am supposed to go to http://localhost and the project should run. But I get this: enter image description here

I am using apache2 and mysql

sayan saha
  • 91
  • 2
  • 8
Arnold Asllani
  • 155
  • 1
  • 12

2 Answers2

10

tl;dr

Go to ./laradock/.env and search for APACHE_DOCUMENT_ROOT then edit that line to this:

APACHE_DOCUMENT_ROOT=/var/www/public

Things to do after the change

For this change to take effect, you have to:

  • Rebuild the container: docker-compose build apache2
  • Restart the containers: docker-compose up

Explanation

As mentioned by simonvomeyser on GitHub this is a recent addition which had the same effect as rodion.arr's solution but this way you can leave the original config files untouched and use the .env file to store all your project related configurations. Obviously, since this is a docker config change, you have to rebuild and restart your container, as rodion-arr and 9bits ponted it out in the same thread.

totymedli
  • 29,531
  • 22
  • 131
  • 165
  • 1
    *Rebuild* is key here! I just stopped and restarted containers and didn't work. You **must** rebuild. – zedee Jul 13 '19 at 13:25
  • FYI just `docker compose up -d apache2` was enough for me, resulted in `Creating laradock_apache2_1 ... done`. This seems consistent with the [up docs](https://docs.docker.com/compose/reference/up/), which say _"If there are existing containers for a service, and the service’s configuration or image was changed after the container’s creation, docker-compose up picks up the changes by stopping and recreating the containers (preserving mounted volumes)."_ – Daryn Feb 24 '20 at 12:16
2

Check you apache configuration (in my case [laradock_folder]/apache2/sites/default.apache.conf file).

You should have DocumentRoot /var/www/public/. I suppose you have /var/www/ instead

rodion.arr
  • 91
  • 14
  • I would recommend to change the `APACHE_DOCUMENT_ROOT` key to `/var/www/public` simply in laradock's `.env` ` – ZR87 Sep 20 '20 at 20:16