docker logs -f <container name>)
Fetch the prebuilt image in your custom images:
Docker Hub:
docker pull mafio/phpnginx
If you get "no basic auth credentials", see this page.
docker-compose up
Now you can access your site at http://localhost:8080 and the MySQL database at db:3306.
The folder ./main will be created and you can put your project files there.
The urls are:
If you copied files into ./main you need to run:
sudo chown -R nobody:nogroup ./main
sudo chmod -R 777 ./main
This makes sure that the files have the correct owner inside the container but remain writable outside of it.
docker build . -t php
docker run -p 8080:8080 -t php
Go to:
http://localhost:8080/
If you want to extend or customize that you can do so by mounting a configuration file in the correct folder.
Configure cron
COPY config/cron-task /var/spool/cron/crontask" add to Dockerfile
Configure nginx
COPY config/nginx.conf /etc/nginx/nginx.conf
Configure PHP-FPM
COPY config/fpm-pool.conf /etc/php8/php-fpm.d/www.conf COPY config/symfonycli/symfony /usr/local/bin/symfony COPY config/php.ini /etc/php8/conf.d/custom.ini COPY config/ssmtp.conf /etc/ssmtp/ssmtp.conf
Configure supervisord
COPY config/supervisord.conf /etc/supervisor/conf.d/supervisord.conf
Setup document root
RUN mkdir -p /main/public COPY config/nginx.conf /etc/nginx/nginx.conf COPY config/xdebug.ini /etc/php8/conf.d/50_xdebug.ini
This image was inspired byDocker Hub and this subsequent fork.
docker pull mafio69/phpnginx:latest