Using nginx's upstream
to switch Xdebug on or off is interesting — I've never configured Xdebug that way before. Of course I'd need something similar to en/disable Xdebug in Apache (I assume it's possible), and indeed for the command line for those occasions you might want to Xdebug a command line PHP script.
I'm really hoping my port-monitoring solution might provide a way to switch Xdebug in all scenarios, in a transparent manner. I've put a proof-of-concept into the current release of Indigo, whereby I show a little green "On" light beside Xdebug in the PHP service, when Indigo detects a GDBP debugger is active. Two things to note about this implementation right now:
1) it doesn't actually enable or disable Xdebug; right now Xdebug is permanently on.
2) it's currently buggy! The light sometimes does not turn on, or sometimes not turn off, when it should.
Please let me know if I'm misunderstanding something and this idea fundamentally would not work for you this way. But otherwise, give it a crack and see if the light enables/disables when you would expect it to.