If you do not specify any file name in the URL, by default, the server will look for the files index.html, index.htm, index.shtml, index.cgi, index.php3, and index.php, in that order.
That means, if you want your homepage to be displayed when the end user types "http://www.your-domain.com", then you must name your hompage index.html.
You can put your cgi-scripts inside the "cgi-bin" directory. But any cgi-script that is placed within the "htdocs" folder but outside the "cgi-bin" can also run.
Rename your scripts with the extension ".cgi". This will tell the server to run it as a cgi-script instead of just displaying it's contents.
Most probably, this happens because the script cannot be executed in the first place. The possible reasons why a script will not execute are:
The cgi-script is uploaded in binary format. Make sure that the scripts are uploaded in ASCII format. As a general rule, all pictures should be uploaded in binary format. Everything else should be in ASCII format.
The cgi-script is not set to executable format. You can connect to the server and issue the command chmod 750 filename to set it to executable mode. Click here to find out more about the chmod command.