Question

I'd like my BeagleBone Black to start up and start web-serving with a custom web server, without the need to log in and configure/launch/change anything.

I suppose this question is two-fold:

  • How do I remove all of the default, redundant, or conflicting startup web server behavior? I am running stock Angstrom, 3.8.13.

  • Assuming I have my own web server executable (in my case a twistd web server), how do I configure it to launch automatically upon board startup?

Thank you very much for any help you can give me.

Was it helpful?

Solution 2

The bbb uses systemd and service files to control how services start -- there's a README on your bbb in /etc/init.d that provides some info and links. There are also some good pages on systemd at http://fedoraproject.org/wiki/Systemd. There are many services configured by default. Try typing: systemctl list-units This will give you a list of services and some minimal status info. Each of the listed services is configured by (usually) simple service files that tell systemd how to start and these files are in /lib/systemd/system for the most part. I'm not entirely sure what you are asking in your first question, but it sounds like you want to get rid of the "built-in" webserver -- I'm pretty new to bbb myself, and I don't know the answer for sure, but if I find out more I'll post it here.

OTHER TIPS

Intro

I think you are trying to do the same as me, i.e. change the webpage that you see in a browser when you navigate to the BBB's IP address from its default bone101 page to your own custom webpage written in HTML or whatever.

Based partly on the answers on this page plus my own trial and error, I have worked out how to do that and I provide a full and complete answer below.

Clarification of Confusing Points in Other Answers

But first, to clarify some confusing points in the other answers on this page:

  • When you plug the BBB into your computer via USB and navigate your browser to the BBB's IP address (192.168.7.2 by default), you get the default bone101 page located (by default) at /usr/share/bone101/index.html

  • If you plug your BBB directly into your router via ethernet (or setup a wifi connection), you can then browse to the BBB's IP address on the network and you will get the same webpage.

  • If you then set up port forwarding on your router to forward incoming http traffic to the BBB and you then access your network's external IP address (either directly or via your domain (www.example.com) which points to that IP address), then you will also get the same webpage.

This is ultimately what I and, I believe, the OP are trying to change. I want to use my BBB as a web server to serve my own website and I don't want people going to www.my-website.com to see the default bone101 stuff.

The Solution

NB: I am running the latest Debian ARM image, not angstrom, so the default locations may be different.

First disable and stop the existing bone101 stuff, as per Bas Wijnen's answer:

systemctl disable bonescript.socket
systemctl disable bonescript.service
systemctl stop bonescript.socket
systemctl stop bonescript.service

Then edit the apache web server configuration. Start by editing the port listening configuration:

sudo vim /etc/apache2/ports.conf

and change this line:

Listen 8080

to this:

Listen 80

as port 80 is the default port for http traffic. Otherwise people would have to go to www.your-website.com:8080 which is just silly.

Then, as noted in the above file, you will also have to edit the sites enabled configuration:

sudo vim /etc/apache2/sites-enabled/000-default.conf

Edit the first line from this:

<VirtualHost *:8080>

to this:

<VirtualHost *:80>

Then either put your content in the directory noted in the DocumentRoot field (this is the directory to be used as the root of your website), which is by default /var/www/html, or change the DocumentRoot field to point to the directory you want to use. In my case, I left it as /var/www/html but then made that a symlink to a directory within a git repository where my website content is.

Or if you just want to do a quick test, symlink or copy the apache default test page into the DocumentRoot directory or change the field to point to the directory where the apache default test page is located (by default, /usr/share/apache2/default-site/index.html)

Then restart apache, et voilà:

sudo /etc/init.d/apache2 restart

The html pages on the BBB's storage devices are only accessible to you as you are connected over the USB cable.

That is not the case on the BBB here. While the default "/support/bone101" web pages are indeed accessible over USB at 192.168.7.2 on interface USB0, they also appear at the BBB's dynamic IP address over the regular network interface eth0 at, e.g., 192.168.1.132 on my local network.

Running "Linux beaglebone 3.8.13 #1 SMP Tue Jun 18 02:11:09 EDT 2013 armv7l GNU/Linux" so YMMV on other releases, of course.

I'm looking at setting up the 'Bone as a remote monitoring hub that is served at the base IP address, the search for which is what got me here. With all of one day's runtime on the BBB, the journey is just beginning ...

I installed lighttpd using opkg. The lighttpd.conf file ends up in /etc where you can specify the port:

 --> cat lighttpd.conf | grep port
## bind to port (default: 80)
server.port                = 2080

and such:

server.document-root        = "/www/pages/"
server.errorlog             = "/www/logs/lighttpd.error.log"
accesslog.filename          = "/www/logs/access.log"

www/pages is where you will find the index.html. It works!

You don't have to disable the old original getting started web interface at all, just add your own and make it your default.

Port 80 is taken by "bonescript.socket", which is used by "bonescript.service". To disable it, to:

systemctl disable bonescript.socket
systemctl disable bonescript.service
systemctl stop bonescript.socket
systemctl stop bonescript.service

The first two lines are for making sure it doesn't start at system boot, the last two for stopping the currently running version.

First you need to be clear on the web interface that comes on the BBB when you access it as a simple flash device like any other thumb drive as differentiated from running a web server on the BBB's operating system with something like Apache. When you are "getting started" with the BBB you can access the html files and lots of DOC just by clicking on the links you see on the BBB, but those are just files that you are accessing like you would from your own hard drive. If you boot the Angstrom Linux distro, which you will just by powering it on, you can then log in to a terminal session and the world is your oyster. From the BBB you can download packages (like a web server) and create any kind of site you wish. At that point you can enter the url of your new web server on your main desk top (PC or whatever), add it to your favorites (bookmarks) and it should "launch automatically". The html pages on the BBB's storage devices are only accessible to you as you are connected over the USB cable. The html pages that a web server could serve up are accessible to anyone who has access to your network from any where around the world, given the right url address. HTH.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top