HTTP + PHP

I think the web-server running on the beagleBone Black is nodejs, however I’m struggling to find any information on how it is configured and where the documents are servered up from.

I would like to add PHP support to the web-server, is this possible with nodejs or would I need to switch to lighthttpd ?

Ok, after a little searching found the default document root:

/usr/share/bone101/

The short answer to your question though is no. NodeJs is an environment for running Javascript applications. In thoery, you could install an NodeJs based webserver and use a fastCGI script to hand the requests off to PHP, but it would be very unconventional. Instead I would focus on installing either a light-weight webserver (such as nginx or lighttpd), or failing that go with Apache.

Once you have the web server up and serving static files, then you should find lots of documentation online for getting PHP running with one of those web servers.

To the OP,

Look for instructions on setting up a LAMP server. The bbb should be more than capable. As for Bonescript, bonescipt and PHP / apache etc should be able to coexist on the same machine. However, do note that default port settings would have to be dealt with. E.G. only one server can use port 80 at a time.

Honestly I have not looked deeply into bonescript yet, but you could probably write your own hybrid to do exactly what you want. If thats what you’re after. Or create your own custom node.js “app” to work with your Apache/PHP setup. That, and there are man other ways to skin this cat . . . C program with embedded web server . . . etc etc.

Thanks for the replies, I’ll take a look tonight, I couldn’t find any references or configuration for the web-server. As sugested I will probably use another web-server, but this would require removing the present config to stop it listening on port 80.

The port that the node.js webserver listens on is set in the file /lib/systemd/system/bonescript.socket with the ListenStream parameter. I moved my node.js webserver to listen on port 8080. So now I can access the node.js server on port 8080 as well as the lighttpd server on port 80.