The following features work out of the box without any configuration:
Nginxserves as the web host and reverse proxyPHP-FPM/OPcachefor fast performance in the browser and on the CLIcomposeris installed and ready to use to setup all your dependenciesmysql_pdois installed as the driver for MariaDB/Mysql connectionspgsql_pdois installed as the driver for PostgreSQL connectionsgdis installed for image processingzipis installed for items that may need that
This image offers platform support for the following architectures:
- linux/amd64
- linux/arm64
- linux/arm/v7
# Dockerfile
FROM: komandar/nginx-php:latest
# docker-compose
image: komandar/nginx-php:latestVanilla PHP and HTML
Place your PHP or HTML site files into /var/www/app/public inside the container to get started with this image. This can be achieved by using a volume in a docker-compose file or by copying them over in a Dockerfile. If you are using HTML instead of PHP, ensure you remove the index.php file so that your index.html file can take priority.
Laravel
Place the root of your laravel project in /var/www/app so that the public folder of laravel lines up with the directory served by this nginx image (see examples/laravel for more details).
Want to give this image a spin? Simply run the following:
docker compose up -dOnce the container spins up, navigate to http://localhost:8888 in a browser.
Tags for this image follow the syntax of PHP_VERSION[:IMAGE_TYPE]; for instance, a valid tag would be 8.1 signifying to use PHP v8.1 of this image.
PHP Versions
8.1- uses the latest release on the PHP 8.1 Alpine track.
Standalone Tags
latest- uses the latest release of this image.
Note: Alpine Linux does not keep old versions of packages. This image pins to the relative major version to try staying flexibile. Future builds may need to be altered if packages are no longer offered.
# Test nginx configuration
nginx -TReleasing
When releasing this project, push to the branch related to the php version.
This image supports swapping in the version number of PHP with a value from the official PHP-FPM Alpine tag list.
Automated Builds
GitHub Actions will automatically build and push supported tags to Docker Hub on each new release. Additionally GitHub Actions will automatically build the latest tag on any push to the main branch. It is highly recommended that you use a versioned release of this image to avoid any transient changes introduced in any given latest build.
Manual Builds
docker build -t komandar/nginx-php:8.1 --build-arg PHP_VERSION=8.1 .
docker push komandar/nginx-php:8.1