Ubuntu is based on Debian so it should apply to Ubuntu as well. I have tested this on latest Debian Testing (on SparkyLinux). I usually use WordPress and CakePHP on my localhost so I included instructions at the end to make them work perfectly.
Warning: This config is not designed with security in mind, only for convenience of desktop users. If you are setting up for server, please refer to proper manuals.
Note: This config is experimental. There might be better way to do some aspects. But it does work for my specific needs so I made it available. Please use carefully.