Speeding up PHP in Docker

Опубликовано: 04 Апрель 2026
на канале: nystudio107
257
1

Set up separate Docker containers for PHP so normal requests go to a container with no xdebug enabled, and are much faster. But if you enable xdebug, Nginx routes it to another container running PHP that does have xdebug enabled

default Docker DNS server
resolver 127.0.0.11;

map $cookie_XDEBUG_SESSION $my_fastcgi_pass {
default php_xdebug;
'' php;
}

...

location ~ [^/]\.php(/|$) {
fastcgi_pass $my_fastcgi_pass:9000;