安裝Nginxphp
docker pull nginx
安裝PHPhtml
docker pull php:7.3.5-fpm
啓動PHP-FPMnginx
docker run --name myphpfpm -v /data/ftp:/www -d php:7.3.5-fpm
/data/ftp 是外部路徑 www 是docker裏的映射路徑docker
Nginx配置文件網絡
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; } }
配置文件說明:php-fpm
啓動Nginxspa
docker run --name php_nginx -p 8089:80 -d -v /data/ftp:/user/share/nginx/html:ro -v /data/nginx/conf/conf.d:/etc/nginx/conf.d:ro --link myphpfpm:php nginx