1 安装php
docker run -p 9000:9000 -d --name myphp-fpm -v /myweb/html:/var/www/html php:7.1-fpm
2 安装nginx
配置 laravel_php.conf
server { listen 80; server_name localhost; root /usr/share/nginx/html/yourname/public; index index.php index.html index.htm; location / { try_files $uri $uri/ =404; } location ~ \.php$ { fastcgi_pass 172.17.0.3:9000; fastcgi_index index.php; #fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; fastcgi_param SCRIPT_FILENAME /var/www/html/yourname/public$fastcgi_script_name; include fastcgi_params; } location ~ /\.ht { deny all; } }
原文:https://www.cnblogs.com/polax/p/14433820.html