Listening to port 80

43 views
Skip to first unread message

kael

unread,
Aug 22, 2009, 12:14:45 AM8/22/09
to moch...@googlegroups.com
Hello,

I'm starting to use Mochiweb (rev104) on Ubuntu Jaunty, I've been able
to run the myapp example, but can't find how to handle requests on port
80 whereas it works on other ports.

When running the example after having modified myapp_sup.erl with
'{port, 80}', launching it returns the following error message :

=PROGRESS REPORT==== 22-Aug-2009::06:01:45 ===
application: crypto
started_at: nonode@nohost
** Found 0 name clashes in code paths

=CRASH REPORT==== 22-Aug-2009::06:01:45 ===
crasher:
initial call: mochiweb_socket_server:init/1
pid: <0.53.0>
registered_name: []
exception exit: {undef,[{fdsrv,start,[]},
{mochiweb_socket_server,init,1},
{gen_server,init_it,6},
{proc_lib,init_p_do_apply,3}]}
in function gen_server:init_it/6
ancestors: [myapp_sup,<0.51.0>]
messages: []
links: [<0.52.0>]
dictionary: []
trap_exit: true
status: running
heap_size: 377
stack_size: 24
reductions: 399
neighbours:

=SUPERVISOR REPORT==== 22-Aug-2009::06:01:45 ===
Supervisor: {local,myapp_sup}
Context: start_error
Reason: {undef,[{fdsrv,start,[]},
{mochiweb_socket_server,init,1},
{gen_server,init_it,6},
{proc_lib,init_p_do_apply,3}]}
Offender: [{pid,undefined},
{name,myapp_web},
{mfa,
{myapp_web,start,
[[{ip,"0.0.0.0"},
{port,80},
{docroot,

"/home/kael/bin/erlang/myapp/priv/www"}]]}},
{restart_type,permanent},
{shutdown,5000},
{child_type,worker}]


=INFO REPORT==== 22-Aug-2009::06:01:45 ===
application: myapp
exited: {shutdown,{myapp_app,start,[normal,[]]}}
type: temporary


I've tried with different local IP and have checked with netstat that no
service is running on that port.

Could someone please enlighten me on what I'm missing ?

Cheers.

--
kael

Yoan Blanc

unread,
Aug 22, 2009, 6:44:48 AM8/22/09
to moch...@googlegroups.com
http://xkcd.com/149/

--
Yoan

2009/8/22 kael <ka...@laposte.net>:

Kunthar

unread,
Aug 22, 2009, 4:09:52 AM8/22/09
to moch...@googlegroups.com
Run as root.
Check permissions.

kael

unread,
Aug 22, 2009, 9:54:30 AM8/22/09
to moch...@googlegroups.com
On 08/22/2009 10:09 AM, Kunthar wrote:
>
> Run as root.

Thanks for the solution.

> Check permissions.

Erm, not sure to know which permissions to check.

--
kael

Steve Davis

unread,
Aug 22, 2009, 5:30:30 PM8/22/09
to MochiWeb
I wouldn't happily suggest you leave a web server running as root.
Apache starts as root but changes user once the port is open. I
believe yaws uses fdsrv to get to port 80 so it may be worth adding
that to your mochi code.

I'd be interested if anyone has a technique (using erlang) to overcome
this...

Andy Gross

unread,
Aug 22, 2009, 8:59:39 PM8/22/09
to moch...@googlegroups.com, MochiWeb
IIRC, mochiweb already supports fdserv. Check the list archives or
grep for 'fdserv' in the mochiweb source...

On Aug 22, 2009, at 5:30 PM, Steve Davis

Ghalib Suleiman

unread,
Aug 24, 2009, 11:14:59 AM8/24/09
to MochiWeb
I just used iptables to route all port 80 traffic to whatever port
Mochiweb is running on.

On Aug 22, 8:59 pm, Andy Gross <a...@andygross.org> wrote:
> IIRC, mochiweb already supports fdserv.  Check the list archives or  
> grep for 'fdserv' in the mochiweb source...
>
> On Aug 22, 2009, at 5:30 PM, Steve Davis  
>

Steve Davis

unread,
Aug 24, 2009, 4:43:24 AM8/24/09
to MochiWeb
...and indeed your memory would serve correctly. i just checked the
mochi code and fdsrv is indeed supported by mochi too!
Reply all
Reply to author
Forward
0 new messages