mirror of
https://github.com/mashirozx/docker-php-nginx.git
synced 2024-11-01 04:28:14 +08:00
Switch to trafex/php-nginx repository
This commit is contained in:
parent
8f3920f3f9
commit
dab1e6766f
33
README.md
33
README.md
@ -1,12 +1,12 @@
|
|||||||
# Docker PHP-FPM 8.0 & Nginx 1.18 on Alpine Linux
|
# Docker PHP-FPM 8.0 & Nginx 1.18 on Alpine Linux
|
||||||
Example PHP-FPM 8.0 & Nginx 1.18 setup for Docker, build on [Alpine Linux](https://www.alpinelinux.org/).
|
Example PHP-FPM 8.0 & Nginx 1.18 setup for Docker, build on [Alpine Linux](https://www.alpinelinux.org/).
|
||||||
The image is only +/- 35MB large.
|
The image is only +/- 40MB large.
|
||||||
|
|
||||||
Repository: https://github.com/TrafeX/docker-php-nginx
|
Repository: https://github.com/TrafeX/docker-php-nginx
|
||||||
|
|
||||||
|
|
||||||
* Built on the lightweight and secure Alpine Linux distribution
|
* Built on the lightweight and secure Alpine Linux distribution
|
||||||
* Very small Docker image size (+/-35MB)
|
* Very small Docker image size (+/-40MB)
|
||||||
* Uses PHP 8.0 for better performance, lower CPU usage & memory footprint
|
* Uses PHP 8.0 for better performance, lower CPU usage & memory footprint
|
||||||
* Optimized for 100 concurrent users
|
* Optimized for 100 concurrent users
|
||||||
* Optimized to only use resources when there's traffic (by using PHP-FPM's on-demand PM)
|
* Optimized to only use resources when there's traffic (by using PHP-FPM's on-demand PM)
|
||||||
@ -15,31 +15,30 @@ Repository: https://github.com/TrafeX/docker-php-nginx
|
|||||||
* Follows the KISS principle (Keep It Simple, Stupid) to make it easy to understand and adjust the image to your needs
|
* Follows the KISS principle (Keep It Simple, Stupid) to make it easy to understand and adjust the image to your needs
|
||||||
|
|
||||||
|
|
||||||
[![Docker Pulls](https://img.shields.io/docker/pulls/trafex/alpine-nginx-php7.svg)](https://hub.docker.com/r/trafex/alpine-nginx-php7/)
|
[![Docker Pulls](https://img.shields.io/docker/pulls/trafex/php-nginx.svg)](https://hub.docker.com/r/trafex/php-nginx/)
|
||||||
[![Docker image layers](https://images.microbadger.com/badges/image/trafex/alpine-nginx-php7.svg)](https://microbadger.com/images/trafex/alpine-nginx-php7)
|
|
||||||
![nginx 1.18.0](https://img.shields.io/badge/nginx-1.18-brightgreen.svg)
|
![nginx 1.18.0](https://img.shields.io/badge/nginx-1.18-brightgreen.svg)
|
||||||
![php 8.0](https://img.shields.io/badge/php-8.0-brightgreen.svg)
|
![php 8.0](https://img.shields.io/badge/php-8.0-brightgreen.svg)
|
||||||
![License MIT](https://img.shields.io/badge/license-MIT-blue.svg)
|
![License MIT](https://img.shields.io/badge/license-MIT-blue.svg)
|
||||||
|
|
||||||
### Breaking changes (26/01/2019)
|
### Docker Hub repository name change
|
||||||
|
Since we switched to PHP8 the repository name [trafex/alpine-nginx-php7](https://hub.docker.com/r/trafex/alpine-nginx-php7) didn't make sense anymore.
|
||||||
|
Because you can't change the name of the repository on Docker Hub I created a new one.
|
||||||
|
|
||||||
Please note that the new builds since 26/01/2019 are exposing a different port to access Nginx.
|
From now on this image can be pulled from Docker Hub under the name [trafex/php-nginx](https://hub.docker.com/r/trafex/php-nginx).
|
||||||
To be able to run Nginx as a non-privileged user, the port it's running on needed
|
|
||||||
to change to a non-privileged port (above 1024).
|
|
||||||
|
|
||||||
The last build of the old version that exposed port 80 was `trafex/alpine-nginx-php7:ba1dd422`
|
The old repository will still be available and kept up to date with [trafex/php-nginx](https://hub.docker.com/r/trafex/php-nginx).
|
||||||
|
|
||||||
## Usage
|
## Usage
|
||||||
|
|
||||||
Start the Docker container:
|
Start the Docker container:
|
||||||
|
|
||||||
docker run -p 80:8080 trafex/alpine-nginx-php7
|
docker run -p 80:8080 trafex/php-nginx
|
||||||
|
|
||||||
See the PHP info on http://localhost, or the static html page on http://localhost/test.html
|
See the PHP info on http://localhost, or the static html page on http://localhost/test.html
|
||||||
|
|
||||||
Or mount your own code to be served by PHP-FPM & Nginx
|
Or mount your own code to be served by PHP-FPM & Nginx
|
||||||
|
|
||||||
docker run -p 80:8080 -v ~/my-codebase:/var/www/html trafex/alpine-nginx-php7
|
docker run -p 80:8080 -v ~/my-codebase:/var/www/html trafex/php-nginx
|
||||||
|
|
||||||
## Configuration
|
## Configuration
|
||||||
In [config/](config/) you'll find the default configuration files for Nginx, PHP and PHP-FPM.
|
In [config/](config/) you'll find the default configuration files for Nginx, PHP and PHP-FPM.
|
||||||
@ -47,15 +46,15 @@ If you want to extend or customize that you can do so by mounting a configuratio
|
|||||||
|
|
||||||
Nginx configuration:
|
Nginx configuration:
|
||||||
|
|
||||||
docker run -v "`pwd`/nginx-server.conf:/etc/nginx/conf.d/server.conf" trafex/alpine-nginx-php7
|
docker run -v "`pwd`/nginx-server.conf:/etc/nginx/conf.d/server.conf" trafex/php-nginx
|
||||||
|
|
||||||
PHP configuration:
|
PHP configuration:
|
||||||
|
|
||||||
docker run -v "`pwd`/php-setting.ini:/etc/php7/conf.d/settings.ini" trafex/alpine-nginx-php7
|
docker run -v "`pwd`/php-setting.ini:/etc/php7/conf.d/settings.ini" trafex/php-nginx
|
||||||
|
|
||||||
PHP-FPM configuration:
|
PHP-FPM configuration:
|
||||||
|
|
||||||
docker run -v "`pwd`/php-fpm-settings.conf:/etc/php7/php-fpm.d/server.conf" trafex/alpine-nginx-php7
|
docker run -v "`pwd`/php-fpm-settings.conf:/etc/php7/php-fpm.d/server.conf" trafex/php-nginx
|
||||||
|
|
||||||
_Note; Because `-v` requires an absolute path I've added `pwd` in the example to return the absolute path to the current directory_
|
_Note; Because `-v` requires an absolute path I've added `pwd` in the example to return the absolute path to the current directory_
|
||||||
|
|
||||||
@ -64,8 +63,8 @@ _Note; Because `-v` requires an absolute path I've added `pwd` in the example to
|
|||||||
|
|
||||||
If you need [Composer](https://getcomposer.org/) in your project, here's an easy way to add it.
|
If you need [Composer](https://getcomposer.org/) in your project, here's an easy way to add it.
|
||||||
|
|
||||||
```dockerfile
|
```Dockerfile
|
||||||
FROM trafex/alpine-nginx-php7:latest
|
FROM trafex/php-nginx:latest
|
||||||
|
|
||||||
# Install composer from the official image
|
# Install composer from the official image
|
||||||
COPY --from=composer /usr/bin/composer /usr/bin/composer
|
COPY --from=composer /usr/bin/composer /usr/bin/composer
|
||||||
@ -93,6 +92,6 @@ RUN composer install \
|
|||||||
|
|
||||||
# continue stage build with the desired image and copy the source including the
|
# continue stage build with the desired image and copy the source including the
|
||||||
# dependencies downloaded by composer
|
# dependencies downloaded by composer
|
||||||
FROM trafex/alpine-nginx-php7
|
FROM trafex/php-nginx
|
||||||
COPY --chown=nginx --from=composer /app /var/www/html
|
COPY --chown=nginx --from=composer /app /var/www/html
|
||||||
```
|
```
|
||||||
|
Loading…
Reference in New Issue
Block a user