CakePHP bin/cake server not accessible from outside VirtualBox

I have a Mac with VirtualBox:

  • macOS 10.12.6
  • VirtualBox 5.1.26

And an Ubuntu 16.04.3 LTS virtual machine running on VirtualBox.

A CakePHP app is configured with Apache running on port 80. It’s perfectly accesible from port 8888 on Mac, redirected to VM port 80.

I just installed a new CakePHP app on the same VM. I run bin/cake server and I added a redirection 8765 -> 8765 to access the new app from the Mac, but there’s no answer from this port on the Mac terminal nor browser. Not even in curl or telnet.

Because port 80 is running well, I stopped the Apache service and run sudo bin/cake server --port 80 and still no response on Mac.

When testing from another VM terminal, the webapp generated page is accesible without problem.

Both Mac & Ubuntu firewalls are disabled while testing.

Why this strange behavior? Any idea?


By default it binds to localhost so not accesible by any IP you should run with an IP (maybe assigned by virtual box)

bin/cake server -H

What it worked finally was:

$ bin/cake server -H

Thanks to @steinkel. Thank you @raul338 for the tip.

Note added to CakePHP book with that tip.

Feel free to translate the note to other languages :slight_smile: