PLEASE NOTE: This article is obsolete or related to a discontinued product.

Setting up BOA to accept CGI

written by the John Crispin

If you want to access custom html pages on your FOX Board, you simply put them in /etc/httpd/html/ directory and accesso to it from this URL:

However, if you want to use CGI, you need to create a new CGI folder.

To do this, you need to :

  • Create a new folder /etc/httpd/cgi typing:
    # cd /etc/httpd
    # mkdir cgi
    
  • Edit the file /etc/httpd/conf/boa.conf and add the following line:
    ScriptAlias /cgi/ /etc/httpd/cgi/
    
  • Restart the BOA web server typing:
    # /etc/init.d/httpd restart
     * Restarting web server...                                             [ ok ]
    
  • Place a CGI script in the /etc/httpd/cgi folder. You can start with the classic "Hello world !" copying this source:
    #!/bin/sh
    echo "Content-type: text/html\n"
    echo "Hello world !"
    
  • Don't forget to make your script executable with the command:
    # chmod +x helloworld.sh
    
  • Run the CGI script from your browser using this URL:

Troubleshooting

403 Forbidden

"Your client does not have permission to get URL /cgi/helloworld.sh from this server"

If you obtain this message probably the helloworld.sh script is not executable. Use this command:

# chmod +x helloworld.sh

502 Bad Gateway

"The CGI was not CGI/1.1 compliant"

If you obtain this message probably you have used a "DOS like" editor like Notepad to edit the helloworld.sh script file. This add a CR/LF sequence at the end of each lines instead of a single LF. If you are using UltraEdit or any other good editor probably you can choose to save the file in Unix format elsewhere use these commands to strip the CR chars:

# cat helloworld.sh | tr -d '\r' > helloworld1.sh
# cp helloworld1.sh helloworld.sh