Setting Up and Configuring the Boa Web Server on CentOS 7
This guide is applicable to CentOS 7 but can be adapted for other Linux distributions.
Download Boa Source Code
Download the source from the Boa Webserver website. After downloading, extract the archive:
tar xzf boa-0.94.13.tar.gz
Install Required Build Tools
Install bison and flex using your package menager:
sudo yum install bison flex
# For Ubuntu/Debian: sudo apt-get install bison flex
Failure to install these tools may cause errors during the build process.
Generate Makefile
Navigate to the source directory and run configure:
cd boa-0.94.13/src
./configure
Configure Boa
-
Create Configuration Directory Create a directory for Boa configuration files:
sudo mkdir /etc/boa sudo cp /home/web/boa-0.94.13/boa.conf /etc/boa/ -
Edit Configuration File Open
/etc/boa/boa.confwith administrative privileges (e.g.,sudo gedit /etc/boa/boa.conf) and make the following changes:- Change
Group nogrouptoGroup 0 - Change
User nobodytoUser 0 - Update
ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/toScriptAlias /cgi-bin/ /var/www/cgi-bin/ - Remove the comment from
#ServerName www.your.org.hereto enable it - Commant out
AccessLog /var/log/boa/access_logby adding a#at the beginning to prevent directory errors
- Change
-
Fix Source Code Issues
- In
boa-0.94.13/src/compat.h, modify:
to:#define TIMEZONE_OFFSET(foo) foo##->tm_gmtoff#define TIMEZONE_OFFSET(foo) (foo)->tm_gmtoff - In
boa-0.94.13/src/log.c, comment out the following block:#if 0 if (dup2(error_log, STDERR_FILENO) == -1) { DIE("unable to dup2 the error log"); } #endif - In
boa-0.94.13/src/boa.c, comment out:#if 0 if (setuid(0) != -1) { DIE("icky Linux kernel bug!"); } #endif
- In
-
Create Web Server Directories Set up directories for web content, logs, and CGI scripts:
sudo mkdir -p /var/www sudo chmod -R 777 /var/www sudo mkdir -p /var/log/boa sudo touch /var/log/boa/error_log /var/log/boa/access_log sudo chmod -R 777 /var/log/boa sudo mkdir -p /var/www/cgi-bin sudo chmod -R 777 /var/www/cgi-bin
Compile Boa
Build the server from the source directory:
cd boa-0.94.13/src
make
Run Boa
Execute the compiled binary:
./boa
If you encounter an error about missing mime.types, ensure the file exists at /etc/mime.types or adjust the configuration accordingly.
Testing
-
CGI Test Copy a sample CGI script to the CGI directory and access it via a browser:
cp boa-0.94.13/examples/cgi-test.cgi /var/www/cgi-bin/Visit
http://127.0.0.1/cgi-bin/cgi-test.cgiin your browser. -
HTML Test Pllace an HTML file in the web root and access it:
echo '<html><body>Test Page</body></html>' > /var/www/test.htmlVisit
http://127.0.0.1/test.html.