July 13, 2013 · bitters debian deploy hacks lighttpd linux node.js nodejs raspberrypi server

Deploying Node JS with lighttpd

When playing around with Bitters, I wanted to serve the node.js application on a system port (80). For sure it is no good idea to run the node app as root (as it is always no good idea to run web accessible apps as root!), therefore we set up a local reverse proxy with lighttpd.

First, make sure mod_proxy is installed and activated in your lighttpd config file. Afterwards, paste the following lines to your config file and amend them appropriate:

$HTTP["host"] == "yourapp.yourhost.com" { 
  proxy.server = (
    "" => (( "host" => "127.0.0.1", 
             "port" => 9001) // your Node.js app's port 
    )
  )

Make sure to specify an IP address and not hostnames as this is a requirement of mod_proxy.

Now you are ready to run your Node.js app. Your app will be available at https://yourapp.yourhost.com after restarting lighttpd.

  • LinkedIn
  • Tumblr
  • Reddit
  • Google+
  • Pinterest
  • Pocket

Contact