HUB
Sign inSign up

mafio69/phpnginx

By mafio69

•Updated over 5 years ago

Image
0

622

mafio69/phpnginx repository overview

⁠Docker PHP-FPM 8.0 & Nginx 1.18 on Alpine Linux XDEBUG AMQP REDIS CRON

  • Built on the lightweight and secure Alpine Linux distribution
  • Very small Docker image size (+/-35MB)
  • Uses PHP 8 for better performance, lower CPU usage & memory footprint
  • Optimized for 100 concurrent users
  • Optimized to only use resources when there's traffic (by using PHP-FPM's on-demand PM)
  • The servers Nginx, PHP-FPM and supervisord run under a non-privileged user (nobody) to make it more secure
  • The logs of all the services are redirected to the output of the Docker container (visible with docker logs -f <container name>)
  • Follows the KISS principle (Keep It Simple, Stupid) to make it easy to understand and adjust the image to your needs

nginx 1.18.0 php 8 License MIT

⁠Includes
  • Composer
  • WP-CLI
  • GD2
  • Various other extensions (like SimpleXML)
  • MySQL CLI
  • Symfony Cli
  • php-ext : amqp redis xdebug
⁠Usage

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:

⁠File permission issues

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.

⁠Quick build / run
docker build . -t php 
docker run -p 8080:8080 -t php

Go to:
http://localhost:8080/⁠

⁠Configuration

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

⁠Acknowledgements

This image was inspired byDocker Hub⁠ and this subsequent fork⁠.

Tag summary
Recent tags
Content type
Image
Digest
Size
115.6 MB
Last updated
over 5 years ago
docker pull mafio69/phpnginx:latest