Docker 安装 PHP安装 PHP 镜像方法一、docker pull php
01
02
03
04
05
06
07
08
09
10
11
12
13
14
|
runoob@runoob:~ /php-fpm $ docker search php NAME DESCRIPTION STARS OFFICIAL AUTOMATED php While designed for web development, the PH... 1232 [OK] richarvey /nginx-php-fpm Container running Nginx + PHP-FPM capable ... 207 [OK] phpmyadmin /phpmyadmin A web interface for MySQL and MariaDB. 123 [OK] eboraas /apache-php PHP5 on Apache (with SSL support), built o... 69 [OK] php-zendserver Zend Server - the integrated PHP applicati... 69 [OK] million12 /nginx-php Nginx + PHP-FPM 5.5, 5.6, 7.0 (NG), CentOS... 67 [OK] webdevops /php-nginx Nginx with PHP-FPM 39 [OK] webdevops /php-apache Apache with PHP-FPM (based on webdevops /php ) 14 [OK] phpunit /phpunit PHPUnit is a programmer-oriented testing f... 14 [OK] tetraweb /php PHP 5.3, 5.4, 5.5, 5.6, 7.0 for CI and run... 12 [OK] webdevops /php PHP (FPM and CLI) service container 10 [OK] ... |
1
|
runoob@runoob:~ /php-fpm $ docker pull php:5.6-fpm |
1
2
3
|
runoob@runoob:~ /php-fpm $ docker images REPOSITORY TAG IMAGE ID CREATED SIZE php 5.6-fpm 025041cd3aa5 6 days ago 456.3 MB |
Nginx + PHP 部署
1
|
$ docker run --name myphp-fpm - v ~ /nginx/www : /www -d php:5.6-fpm |
1
|
mkdir ~ /nginx/conf/conf .d |
01
02
03
04
05
06
07
08
09
10
11
12
13
14
15
16
17
18
19
20
21
|
server { listen 80; server_name localhost; location / { root /usr/share/nginx/html ; index index.html index.htm index.php; } error_page 500 502 503 504 /50x .html; location = /50x .html { root /usr/share/nginx/html ; } location ~ \.php$ { fastcgi_pass php:9000; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME /www/ $fastcgi_script_name; include fastcgi_params; } } |
1
2
3
4
5
|
docker run --name runoob-php-nginx -p 8083:80 -d \ - v ~ /nginx/www : /usr/share/nginx/html :ro \ - v ~ /nginx/conf/conf .d: /etc/nginx/conf .d:ro \ --link myphp-fpm:php \ nginx |
1
2
3
|
<?php echo phpinfo(); ?> |
原文:https://www.cnblogs.com/zhuxiaopijingjing/p/12302637.html