1
1
# Docker PHP-FPM 8.0 & Nginx 1.18 on Alpine Linux
2
2
Example PHP-FPM 8.0 & Nginx 1.18 setup for Docker, build on [ Alpine Linux] ( https://www.alpinelinux.org/ ) .
3
- The image is only +/- 35MB large.
3
+ The image is only +/- 40MB large.
4
4
5
5
Repository: https://github.com/TrafeX/docker-php-nginx
6
6
7
7
8
8
* Built on the lightweight and secure Alpine Linux distribution
9
- * Very small Docker image size (+/-35MB )
9
+ * Very small Docker image size (+/-40MB )
10
10
* Uses PHP 8.0 for better performance, lower CPU usage & memory footprint
11
11
* Optimized for 100 concurrent users
12
12
* Optimized to only use resources when there's traffic (by using PHP-FPM's on-demand PM)
@@ -15,47 +15,46 @@ Repository: https://github.com/TrafeX/docker-php-nginx
15
15
* Follows the KISS principle (Keep It Simple, Stupid) to make it easy to understand and adjust the image to your needs
16
16
17
17
18
- [ ![ Docker Pulls] ( https://img.shields.io/docker/pulls/trafex/alpine-nginx-php7.svg )] ( https://hub.docker.com/r/trafex/alpine-nginx-php7/ )
19
- [ ![ Docker image layers] ( https://images.microbadger.com/badges/image/trafex/alpine-nginx-php7.svg )] ( https://microbadger.com/images/trafex/alpine-nginx-php7 )
18
+ [ ![ Docker Pulls] ( https://img.shields.io/docker/pulls/trafex/php-nginx.svg )] ( https://hub.docker.com/r/trafex/php-nginx/ )
20
19
![ nginx 1.18.0] ( https://img.shields.io/badge/nginx-1.18-brightgreen.svg )
21
20
![ php 8.0] ( https://img.shields.io/badge/php-8.0-brightgreen.svg )
22
21
![ License MIT] ( https://img.shields.io/badge/license-MIT-blue.svg )
23
22
24
- ### Breaking changes (26/01/2019)
23
+ ### Docker Hub repository name change
24
+ 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.
25
+ Because you can't change the name of the repository on Docker Hub I created a new one.
25
26
26
- Please note that the new builds since 26/01/2019 are exposing a different port to access Nginx.
27
- To be able to run Nginx as a non-privileged user, the port it's running on needed
28
- to change to a non-privileged port (above 1024).
27
+ 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 ) .
29
28
30
- The last build of the old version that exposed port 80 was ` trafex/alpine -nginx-php7:ba1dd422 `
29
+ The old repository will still be available and kept up to date with [ trafex/php -nginx] ( https://hub.docker.com/r/trafex/php-nginx ) .
31
30
32
31
## Usage
33
32
34
33
Start the Docker container:
35
34
36
- docker run -p 80:8080 trafex/alpine -nginx-php7
35
+ docker run -p 80:8080 trafex/php -nginx
37
36
38
37
See the PHP info on http://localhost , or the static html page on http://localhost/test.html
39
38
40
39
Or mount your own code to be served by PHP-FPM & Nginx
41
40
42
- docker run -p 80:8080 -v ~/my-codebase:/var/www/html trafex/alpine -nginx-php7
41
+ docker run -p 80:8080 -v ~/my-codebase:/var/www/html trafex/php -nginx
43
42
44
43
## Configuration
45
44
In [ config/] ( config/ ) you'll find the default configuration files for Nginx, PHP and PHP-FPM.
46
45
If you want to extend or customize that you can do so by mounting a configuration file in the correct folder;
47
46
48
47
Nginx configuration:
49
48
50
- docker run -v "`pwd`/nginx-server.conf:/etc/nginx/conf.d/server.conf" trafex/alpine -nginx-php7
49
+ docker run -v "`pwd`/nginx-server.conf:/etc/nginx/conf.d/server.conf" trafex/php -nginx
51
50
52
51
PHP configuration:
53
52
54
- docker run -v "`pwd`/php-setting.ini:/etc/php7/conf.d/settings.ini" trafex/alpine -nginx-php7
53
+ docker run -v "`pwd`/php-setting.ini:/etc/php7/conf.d/settings.ini" trafex/php -nginx
55
54
56
55
PHP-FPM configuration:
57
56
58
- docker run -v "`pwd`/php-fpm-settings.conf:/etc/php7/php-fpm.d/server.conf" trafex/alpine -nginx-php7
57
+ docker run -v "`pwd`/php-fpm-settings.conf:/etc/php7/php-fpm.d/server.conf" trafex/php -nginx
59
58
60
59
_ Note; Because ` -v ` requires an absolute path I've added ` pwd ` in the example to return the absolute path to the current directory_
61
60
@@ -64,8 +63,8 @@ _Note; Because `-v` requires an absolute path I've added `pwd` in the example to
64
63
65
64
If you need [ Composer] ( https://getcomposer.org/ ) in your project, here's an easy way to add it.
66
65
67
- ``` dockerfile
68
- FROM trafex/alpine -nginx-php7 :latest
66
+ ``` Dockerfile
67
+ FROM trafex/php -nginx:latest
69
68
70
69
# Install composer from the official image
71
70
COPY --from=composer /usr/bin/composer /usr/bin/composer
@@ -93,6 +92,6 @@ RUN composer install \
93
92
94
93
# continue stage build with the desired image and copy the source including the
95
94
# dependencies downloaded by composer
96
- FROM trafex/alpine -nginx-php7
95
+ FROM trafex/php -nginx
97
96
COPY --chown=nginx --from=composer /app /var/www/html
98
97
```
0 commit comments