#Setting up BOA to accept CGI
<i>written by the John Crispin</i>

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

* <a href="http://192.168.0.90/local" target="_new">http://192.168.0.90/local</a>

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

To do this, you need to :

<ul>
<li>Create a new folder <b>/etc/httpd/cgi</b> typing:

<pre class="minicom">
# <b>cd /etc/httpd</b>
# <b>mkdir cgi</b>
</pre>

</li> 
<li>Edit the file <b>/etc/httpd/conf/boa.conf</b> and add the following line:
<br>

<pre class="minicom">
ScriptAlias /cgi/ /etc/httpd/cgi/
</pre>

</li>
<li>Restart the BOA web server typing:

<pre class="minicom">
# <b>/etc/init.d/httpd restart</b>
 * Restarting web server...                                             [ ok ]
</pre>

</li>
<li>Place a CGI script in the <b>/etc/httpd/cgi</b> folder. You can start with the classic "Hello world !" 
copying this source:
@source='./helloworld.sh'
</li>
<li>Don't forget to make your script executable with the command:
<pre class="minicom">
# <b>chmod +x helloworld.sh</b>
</li>
</pre>
<li>Run the CGI script from your browser using this URL: 
<ul>
<li><a href="http://192.168.0.90/cgi/helloworld.sh" target="_new">http://192.168.0.90/cgi/helloworld.sh</a>
</ul>
</ul>

##Troubleshooting

###403 Forbidden

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

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

<pre class="minicom">
# <b>chmod +x helloworld.sh</b>
</pre>

###502 Bad Gateway

"<i>The CGI was not CGI/1.1 compliant</i>"

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:

<pre class="minicom">
# <b>cat helloworld.sh | tr -d '\r' > helloworld1.sh</b>
# <b>cp helloworld1.sh helloworld.sh</b>
</pre>
