vagrantjettyportforwardingpuphpet

Accessing Java jetty server on port 9999 using vagrant on local machine


I have setup a centos virtual server using Vagrant and Puphpet, within the VM I have a java app running on jetty. "server is running at http://127.0.0.1:9999"

However im having trouble accessing this from my local machine, I have set up a port forward so 9999 forwards to 9999, but when i visit awesome.dev:9999 or 192.168.56.103:9999 I get a site cant be reached error.

Obviously im missing something in my puphpet config.yaml file, I'm just not sure what.

               machines:
                    vflm_b214h6dav8jj:
                        id: machine1
                        hostname: machine1.puphpet
                        network:
                            private_network: 192.168.56.103
                            forwarded_port:
                                vflmnfp_hmt0pd4imhhd:
                                    host: '5997'
                                    guest: '22'
                                vflmnfp_b74egg9hlvog:
                                    host: '9999'
                                    guest: '9999'
                        memory: '1024'
                        cpus: '1'

If I goto awesome.dev then the hello world page I put in is working, so I know the VM is up and running.


Solution

  • The issue is

    "server is running at http://127.0.0.1:9999"

    so its not accessible on any network interface other than your localhost.

    You need to change this to get started the app on the IP of the server or you can use 0.0.0.0 (special IP so all interfaces can access it)

    You need to change the jetty.host property, there's a few possibilities