On Sat, Sep 27, 2014 at 6:14 PM, Craig Coleman <[email protected]> wrote: > I'd like to try running nodejs on port 80 on a debian and gentoo server > I've seen a lot post how people do this but I'd like to get some additional > advice so I don't screw things up on our test servers. > I'm just getting started with node. > I have installed hapi > Thanks, cwc > > var Hapi = require('hapi'); > var server = new Hapi.Server(80); > > server.route({ > method: 'GET', > path: '/', > handler: function (request, reply) { > reply('Hello, world!'); > } > }); > > server.route({ > method: 'GET', > path: '/{name}', > handler: function (request, reply) { > reply('Hello, ' + encodeURIComponent(request.params.name) + '!'); > } > }); > > server.start(function () { > console.log('Server running at:', server.info.uri); > });
Consider assigning the CAP_NET_BIND_SERVICE capability to the node binary. Run as root: # setcap cap_net_bind_service=+ep $(readlink `which node`) You can remove the capability again with -ep. -- Job board: http://jobs.nodejs.org/ New group rules: https://gist.github.com/othiym23/9886289#file-moderation-policy-md Old group rules: https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines --- You received this message because you are subscribed to the Google Groups "nodejs" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/nodejs/CAHQurc8SF0cmQejs%2B04TD4jhjh-n-WERqp8EXMoXn1i6xNK-5A%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.
