Apache Webserver Integration with NodeJS on Beaglebone Black

Asked by 5 months ago
I am running NodeJS on my Beaglebone Black. I am also running an Apache web server on my PC. The goal is to serve up a page(s) on the Apache server that can send socket.io messages to the micro-controller. Any help would be appreciated

Your Answer


All Answers

Answer by 5 months ago
Since you're using socket.io, I would recommend going for Phusion Passenger + Nginx instead of Apache. Apache's not so good at handling WebSockets while Nginx does an excellent. Phusion Passenger is a Node.js application server, built for Nginx, that makes Node.js deployment on Nginx extremely simple, powerful and performant. You can learn more at https://github.com/phusion/passenger/wiki/Phusion-Passenger:-Node.js-tutorial That link also has a 4 minute intro video that explains the gist of it.
Answer by 5 months ago
The first question is do you need Apache? Nginx is preferred and it supports proxying websocket connections as well. See here http://nginx.org/en/docs/http/websocket.html The second question is do you need a web server at all? It is possible to create a simple ExpressJS application in node that supports SocketIO (and websockets) and can server web pages directly. You will need to create a NodeJS application anyway and can then choose to access it directly or proxied behind another web server. See here http://www.williammora.com/2013/03/nodejs-tutorial-building-chatroom-with.html My opinion is that an extra application server as another poster suggested is not necessary. Passenger can help if you are trying to scale large applications but as this is a home-hobby project this is not the case. Keep it simple. Karl Ostendorf