-
docker
安装php
环境
1 安装nginx
docker pull nginx
2 安装php-fpm
docker pull php:7.2-fpm
3 映射php
环境目录
docker run --name dream-php -d \
-v /usr/local/webservice/:/var/www/html \
php:7.2-fpm
/usr/local/webservice/ . 系统本身文件目录
/var/www/html 镜像目录
4 映射nginx
运行目录和配置目录
docker run --name dream-nginx -d \
-p 80:80 \
-v /usr/local/webservice:/usr/share/nginx/html:ro \
-v /usr/local/webservice-nginx/conf.d:/etc/nginx/conf.d:ro \
--link dream-php:php
nginx
目录列表
|--webservice
--index.php
|--webservice-nginx
|--conf.d
--default.conf
--web.conf
web.conf
server {
listen 80;
server_name www.mingyuan.site;
location / {
root /usr/share/nginx/html/wing;
index index.html index.htm;
}
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 /var/www/html/$fastcgi_script_name;
include fastcgi_params;
}
}