稍加修改
vim dockerfile
# This is a commitFROM shiphp/nginx-env:latestMAINTAINER love coding <237356573@qq.com>USER rootRUN groupadd -g 1000 www && useradd -u1001 -g www -M -s /bin/nologin wwwRUN mkdir -p /usr/www/html && chown -R www:www /usr/www/htmlRUN rm -f /etc/nginx/conf.d/default.confCOPY default.conf /etc/nginx/conf.d/default.confRUN chown -R www:www /etc/nginxEXPOSE 80
docker build -t nginx:v1 .
vim default.conf
server { listen 80; index index.php index.html; root /usr/www/html; client_max_body_size 32M; location / { try_files $uri /index.php?$args; } location ~ \.php$ { fastcgi_split_path_info ^(.+\.php)(/.+)$; fastcgi_pass $ENV{ "NGINX_HOST"}:9000; fastcgi_index index.php; include fastcgi_params; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; fastcgi_param PATH_INFO $fastcgi_path_info; }}
php :docker run -d --name php-fpm-api -v /usr/local/nginx/www:/usr/www/html php-fpm:v6nginx:docker run -d --name nginx -d -p 80:80 -v /usr/local/nginx/www:/usr/www/html --link php-fpm-api -e NGINX_HOST=php-fpm-api nginx:v1