Docker -Basisbild mit Nginx + PHP + FPM. PHP Version 7.3 . Vorinstallierte Module: GD, Reißverschluss, Curl, MySQL, Curl und Mbstring. Alle Env -Vars, die sich hier befinden /var/www/.env . Dokument rootverzeichnis hier /var/www/html . Alle PHP -Einstellungen, die standardmäßig definiert sind, außer der Anzahl von FPM -Gabeln, die auf 1 abgenommen wurden, und für Nginx Server, worker_processes auf 1. Die Zeitzone kann bei Container -Start von -v /etc/timezone:/etc/timezone:ro . Der Standard -Server -Port ist 80 .
Docker Image: https://hub.docker.com/r/vladimirok5959/nginx-php-fpm
function LoadEnvironmentVariables () {
$ f = ' ../.env ' ;
if ( file_exists ( $ f )) {
foreach ( explode ( "n" , file_get_contents ( $ f )) as $ value ) {
if ( trim ( $ value ) != '' ) {
$ pos = strpos ( $ value , ' = ' );
if ( $ pos === false ) continue ;
$ _ENV [ substr ( $ value , 0 , $ pos )] = substr ( $ value , $ pos + 1 , strlen ( $ value ) - $ pos - 1 );
}
}
}
}
// Example:
LoadEnvironmentVariables ();
var_dump ( $ _ENV );docker run
--network host
--name my-container-name
-v /etc/timezone:/etc/timezone:ro
-v /path/to/php/files:/var/www/html
-d -it vladimirok5959/nginx-php-fpm:latest Hostnetzwerk nur zum Beispiel -v /etc/timezone:/etc/timezone:ro zum Erhalten von Zeitzone vom Hostmaschinen und -v /path/to/php/files:/var/www/html für rebind htdocs/www mit PHP -Dateien, nur wenn dieses Bild als ausstehend als ausstehend verwendet wird.