Set your host volume in docker-compose.yml
in web/php container.
web:
[...]
volumes:
- ~/Development:/app
[...]
~/Development
is my local folder where I store all my web projects./app
is the root folder for web/php container, don't change it.
Enable a default conf to serve PHP files:
$ cp nginx/conf.d/000-default.conf.dist nginx/conf.d/000-default.conf
Obviously you can add other config file to add others projects (see _example.conf.dist
).
Set your custom php.ini variables here php/php.ini
.
Add a dummy phpinfo:
$ echo "<?php phpinfo() ?>" > ~/Development/index.php
Since you tweak the conf, restart impacted containers:
$ docker-compose -f /path/to/docker/docker-compose.yml restart php web
Add an entry in /etc/hosts
to point to your custom domain, ie:
192.168.99.100 my.local # for macOS
127.0.0.1 my.local # for linux
Each time you create/delete a server block, you must update your hosts file accordingly.
You should try instead to setup a DNS server to avoid these tedious task. I use dnsmasq and it works like a charm.
No more require config. Check in your browser your awesome new project: http://my.local/