Boa: an Embedded Web Server
Once you have the basics running, check out the config file (boa.conf) for additional configuration options. Here is a quick summary of the most important. The config file is well commented so if you don't see what you need here, read the comments for additional options.
Port allows you to specify the port to listen on. The default is 80, which is the standard HTTP port. For any port less than 1024 you must start Boa as root.
By default, Boa binds to all IP addresses. This means that any request that comes into the system on the specified port is served by Boa. If this isn't acceptable, you can use either the VirtualHost directive to point different requests to different files, or you can run individual copies of Boa for each IP address.
User and Group allow you to specify the name of the user and group Boa runs as. Normally you would start Boa as root, and then once it configures itself, it changes to run as the specified user and group.
ErrorLog and AccessLog allow you to specify where the log files are located. If you comment out the AccessLog line, no access log will be created.
DocumentRoot specifies the root directory of the HTML files.
UserDir specifies a directory name that can be appended onto a user's home directory to locate web pages accessed by using ~user in the URL.
DirectoryIndex specifies the name of the index file. This is traditionally index.html.
DirectoryMaker is the path to the program used to create index listings. Comment this out if you don't want to allow directory listings.
Alias is used to specify a redirect, allowing a specified URL to access a page in a different location. Multiple Alias directives are allowed.
ScriptAlias is used to specify where CGI scripts can reside. Essentially, this allows a shorthand in the URL for locating the scripts.
In order to test Boa I created two files: one HTML file (Listing 1) and a CGI script written as a shell script (Listing 2). Figure 1 shows what is displayed by the HTML script, and Figure 2 shows what is displayed by the CGI script. Note that I created these scripts using vi. If you would rather use an editor specifically designed for creating HTML, many are included with every Linux distribution. For example, KWebDev is one of the many included with KDE. WebMaker is another.
The only problems I encountered were mistakes on my part with configuration parameters and file locations. Once I got everything in the right place, Boa performed as expected. If you have the need for a web server in an embedded product, Boa offers a great choice.
Sid Wentworth prefers animals to people but also sees that computers can be his friend. He has over 20 years of experience working with computers, virtually all without involvement with Microsoft products. Sid can be reached at email@example.com.
- FinTech and SAP HANA
- Chemistry on the Desktop
- Five HPC Cost Considerations to Maximize ROI
- Preseeding Full Disk Encryption
- Hodge Podge
- Two Ways GDPR Will Change Your Data Storage Solution
- William Rothwell and Nick Garner's Certified Ethical Hacker Complete Video Course (Pearson IT Certification)
- Two Factors Are Better Than One
- Returning Values from Bash Functions
- GRUB Boot from ISO