In the official laradock documentation, there is a lot of sample code to run nginx, but laradock also provides a mechanism to use apache.
First of all, if there is a service that is running, let’s bring it down, to prevent troublesome troubles.
Create the following
localhost.conf file in the
laradock/apache2/sites folder on the host OS side.
Options Indexes FollowSymLinks
<IfVersion < 2.4>
Allow from all
<IfVersion >= 2.4>
Require all granted
Then record the localhost.conf file to your Docker image with the following command:
docker-compose build apache2
Now you are ready to go.
Start the container in the same way as for nginx, but specify the apache2 service instead of the nginx service
docker-compose up -d apache2 mysql
There is a difference in the default settings of nginx and apache2 in laradock.
default nginx settings of laradock.
The default setting of nginx of laradock is to make the
/var/www/public folder of the OS in the container as Document Root when accessed from
default apache2 settings of laradock .
On the other hand, in apache2 of laradock, when accessing with
/var/www folder of the OS in the container is set to be published.
If you modify this to expose the
/var/www/public folder like nginx, you can develop laravel with the same usability as when using nginx.
/ laradock / apache2 / sites folder
A file called
sample.conf.example is provided in the
I copied this file, pasted as a new file called localhost.conf, and rewrote the following three directories.
Note that it works even if the file name is not
localhost.conf, but the end of the file name must end with
In laradock, if you save the
* .conf file in the
laradock/apache2/sites/ folder on the host OS side, it seems that it is set to be recognized by apache.