Solved: Remote XDebug from Dockerized PHP app via SSH Tunnel on Ubuntu

expose: - 9000 Remove theports:section fromdocker-compose.yml and define exposeOn the remote machine enableGatewayPorts clientspecifiedin/etc/ssh/sshd_config(then restart the sshd service).This allows you to create an SSH port forward tunnel which listens on all network interfaces (0.0.0.0or*) which is required in order for the Docker container s virtual network interface to reach your client machine via the tunnel.By default, theGatewayPortssetting limits remote port forwardings to bind to thelocalhostinterface only which Docker can t see .Change SSH connection string to explicitly specify that I wanted to listen on the global interface*:ssh -R *:9000:localhost:9000 [email protected] Or with Putty/KittyKitty remote SSH tunnelAfter doing all this, I was finally able to connect to Xdebug running inside a Docker container on the remote server from my local machine. .vscode/launch.json{ version : 0.2.0 , configurations : [ { name : Launch built-in server and debug , type : php , request : launch , runtimeArgs : [ -S , localhost:8000 , -t , . ], port : 9000, serverReadyAction : { action : openExternally } }, { name : Debug current script in console , type : php , request : launch , program : ${file} , cwd : ${fileDirname} , externalConsole : false, port : 9000 }, { name : Listen for Xdebug 9000 , type : php , request : launch , port : 9000, pathMappings : { /var/www/html/ : ${workspaceRoot}/ , }, } ] } xdebug-php.inizend_extension=/usr/local/lib/php/extensions/no-debug-non-zts-20230831/xdebug.so xdebug.mode=debug xdebug.client_port=9000 ;xdebug.client_host=dockerhost xdebug.client_host=xdebug://gateway xdebug.idekey=PHPSTORM xdebug.start_with_request = yes Optionally, if you want to explicitly force Xdebug to connect only to the host machine (meaning you only want to use Xdebug via the SSH tunnel), either:Add the following section to your service indocker-compose.yml: extra_hosts: - host.docker.internal:host-gateway Then setxdebug.client_host=host.docker.internalandxdebug.discover_client_host=OfforSetxdebug.client_host=xdebug://gatewayP.S. A useful command while debugging this wasnc -vz 127.0.0.1 9000which allowed me to check if my SSH port forward was working on the host machine, at least.Original credits to WackGet

projít na článek

Ubuntu 24.04 na cloud.4smart.cz

Do nabídky instalačních zdrojů na cloud.4smart.cz jsme právě začlenili Ubuntu 24.04 LTS.

projít na článek

Jak spustit Ubuntu ve Windows 10?

Ubuntu (Bash) lze vskutku spustit ve Windows 10 (příkazové řádce). Jak na to?

projít na článek

Bash a Ubuntu přímo ve Windows 10? Snadno!

Vyznáte se v prostředí Linuxu a rádi byste příkazovou řádku ve Windows 10 obohatili o klasický Bash? Nyní je možné tyto dva světy propojit snadněji, než kdy dříve. Už od roku 2016 je díky naslouchání Microsoftu požadavkům uživatelů možné ve Windows využív

projít na článek

Free courses server administration, cloud tools

In cloud or in any bigger environment you have to use some tools for automatization and remote management remote management Free Ansible Courses and Tutorials Free Puppet Software Courses and Tutorials containeirs Free Kubernetes Courses and Tutorials Fr

projít na článek

Přednáška THE INCOMPLETE SOUNDNESS OF AIRBORNE REMOTE SENSING IN ARCHAEOLOGY: MYTHS, CHALLENGES AND PROSPECTS

Srdečně zveme na přednášku odborníka na leteckou archeologii prof. Włodzimierze Rączkowského. THE INCOMPLETE SOUNDNESS OF AIRBORNE REMOTE SENSING IN ARCHAEOLOGY: MYTHS, CHALLENGES AND PROSPECTS Kde: Čechyňská 363/19, Brno, velký přednáškový

projít na článek