in reply to Re: Run Perl Mojolicio Server from SSH
in thread Run Perl Mojolicio Server from SSH

The server file is a script that raise the server is has the following code:

#!/usr/bin/env perl use Mojo::Base -strict; use File::Basename 'dirname'; use File::Spec::Functions qw(catdir splitdir); # Source directory has precedence my @base = (splitdir(dirname(__FILE__)), '..'); my $lib = join('/', @base, 'lib'); -e catdir(@base, 't') ? unshift(@INC, $lib) : push(@INC, $lib); # Start commands for application require Mojolicious::Commands; Mojolicious::Commands->start_app('MyServer', 'daemon','-l','http://*:3 +030');

Replies are listed 'Best First'.
Re^3: Run Perl Mojolicio Server from SSH
by Anonymous Monk on Feb 06, 2014 at 10:54 UTC

    What do you expect  'http://*:3030' to resolve to?

    What does the logs say it actually resolves to?

    How is that different from the address you're typing in your browser?

      The server listens on the port 3030 and I use the browser to surf the web client - in the browser I call the server using:

      http://server_address:3030/index.html

      The logs says that the server is up and listening - here what I got after running the server:

       Listening at "http://*:3030"

      Now, if I run the script directly from the linux machine and I open the web page using the url above - the page is loaded.

      But if I run the ssh command to run the server from another machine - the server says it is running and listening - but the link won't open while the server is up in the machine.

      when I run the server from another machine I get the following data in the server machine:

      >ps -ef | grep server_file root 23261 1 0 09:57 ? 00:00:01 /usr/bin/perl server_fi +le >lsof -i perl 23151 root 3u IPv4 8412377 0t0 TCP *:3030 (LISTEN)

      but when I run the server from its own machine - I got the following data:

      >ps -ef | grep server_file root 24163 22640 9 11:12 pts/10 00:00:00 /usr/bin/perl server_fi +le >lsof -i perl 24163 root 3u IPv4 10196650 0t0 TCP *:3030 (LISTEN +)

        Listening at "http://*:3030"

        weeeek :/ I get

        [Thu Feb 6 03:27:58 2014] [info] Listening at "http://*:3000". Server available at http://127.0.0.1:3000.

        The 127.0.0.1 part tells me what the server is :)

        Try specifying explicitly to listen on server_address

        Also try netstat to see what you're listening on