Perl Mojolicious unable to connect to server

Viewed 74

I am attempting to run a Mojolicious server (using Morbo or Hypnotoad) on my VM, but I am unable to connect to my server remotely. Here is my code

use Mojolicious::Lite;
use strict;
use v5.18;

app->config(hypnotoad => {listen => ['http://*:80']});

get '/' => sub {
    my $c = shift;
    return $c->render(text => "At the index end point");
};

get '/foo' => sub {
    my $c = shift;
    return $c->render(text => "At the foo end point");
};

get '/bar' => sub{
    my $c = shift;
    return $c->render(text => "At the bar end point");
};

app->start;

Here is how I start it

$ sudo hypnotoad app2.pl 
$ Starting hot deployment for Hypnotoad server 1960.

I attempt to visit the URL from my address bar and it just hangs.

How can I diagnose this or troubleshoot to see what the issue is?

If I run netstat, I can clearly see that port 80 is open. Doesn't matter if I change to a different port; the same issue (inability to connect) occurs.

$ netstat -lntp

(Not all processes could be identified, non-owned process info
 will not be shown, you would have to be root to see it all.)
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name
tcp        0      0 127.0.0.1:587           0.0.0.0:*               LISTEN      -               
tcp        0      0 0.0.0.0:6379            0.0.0.0:*               LISTEN      -               
tcp        0      0 0.0.0.0:80              0.0.0.0:*               LISTEN      -               
tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN      -               
tcp        0      0 127.0.0.1:5432          0.0.0.0:*               LISTEN      -               
tcp        0      0 127.0.0.1:25            0.0.0.0:*               LISTEN      -               
tcp6       0      0 :::6379                 :::*                    LISTEN      -               
tcp6       0      0 :::22                   :::*                    LISTEN      -        
0 Answers
Related