Forum

Error Binding 127.0.0.1:80 after Reboot Mac OS X 10.8 and Access denied via Filesystem on localhos

Lars
2 August 2012, 18:51
Hi,

Hiawatha started after installing but exits with "Error binding 127.0.0.1:80" after a Reboot of Mountain Lion. Nothing else listens on port 80 on localhost according to lsof and netstat.

I disabled the interface binding (only port binding remains) and when accessing localhost, I get a "Access denied via filesystem" in the 127.0.0.1 website error log. Safari shows a black page with white text 403 - Access denied.
I chmod 755 web which is the 127.0.0.1 document root: /Users/me/Documents/web, as well as index.html inside web, which is the start page. This didn't help.



Lars
Hugo Leisink
2 August 2012, 19:26
The "Error binding" is probably because you didn't start Hiawatha via the user 'root'. Binding to a port below 1024 requires root access.

Hiawahta is probably running as user nobody, which doesn't have access to your home directory. Change it to your user id via the ServerID setting.
Lars
2 August 2012, 19:38
I used sudo. I now have tried two approaches: change the port, use my user as ServerId. At first, it worked, however, after every kill (or reboot) the previously working port doesn't get bound. I now have tried 3 ports. At first they were working, then I killed or restarted and the I got an "Error binding".

The filesystem access I tried to circumevent by creating a symbolic link in / pointing to web and assigning 755 to that symbolic link (as I don't know wether everything above web needs 755 too).

So I got it working once. Now it's not working after the reboot.



Lars
Hugo Leisink
3 August 2012, 08:54
I have no idea what you're doing. But since you got Hiawatha working proofs that it's not a Hiawatha issue, but an OS / access rights issue. Make sure the user id you use for Hiawatha has access to the webroot directory. And make sure Apache isn't running while you try to start Hiawatha.
Lars
3 August 2012, 12:15
Well, Hiawatha is my only webserver. When the port can be bound, which now is the case most of the time, Hiawatha serves the pages, thanks.

A followup question regarding cgis because they dont get executed yet: the log shows CGI-wrapper: setuid(0) error. I use WrapCGI to have the cgis executed as the database user. I already sudo chmod u+s cgi-wrapper to no avail. Do you have an idea?

Thanks!
Hugo Leisink
3 August 2012, 14:46
Try first without cgi-wrapper. You don't need to run CGI as the same user as the database user. As long as the CGI application can connect with the right credentials, it's ok.
Lars
3 August 2012, 15:44
Hi,

thanks for the pointer. It works. I wonder why. Using the shell, I cannot connect with my username. And the cgi doesn't set the username and Hiawatha is set to use my username. (It's postgres and using the shell I have to sudo -u postgres psql db to open the database by postgres tool.)

Perhaps you can help me with an ensuing issue that emerged: non-ascii characters in filenames are not correctly displayed in the webborwser. All cgis and htmls are encoded in Latin 9. The filesystem is Mac OS X 10.6s default. There's a file containing a "ü". I use perls readdir. On the shell, the cgi outputs the "ü". In the browser (safari which doesn't offer latin 9 encoding to explicitly select though) the cgi output is shown as something like "I-". I might be asking boldly here as it doesn't relate to Hiawatha it occurs to me but perhaps you have come across this on your usage yourself and have a solution? Thanks anyway.

Thank you!
Hugo Leisink
3 August 2012, 17:12
Most browsers use UTF-8 by default. My advice is to convert everything you send to the browser to UTF-8 and explicitly set the encoding to UTF-8 via the Content-Type HTTP header or the HTML META-tag.
This topic has been closed.