Safari can't connect to the server "localhost"
It seems like you are using Mac's built-in server and maybe somewhere along the line, web sharing was disabled.

Go to your System Preferences and enable Web Sharing.

To be sure httpd has started do what @Kerri mentioned in the comments

ps -eaf | grep httpd


which will display all processes that contain httpd as well as the Process ID

if you only get something like the following

501 22299 22030   0   0:00.00 ttys001    0:00.00 grep httpd


grep is the only process running referencing httpd

At this point try stopping and restarting the server manually

sudo httpd -k stop  
sudo httpd -k restart


Look also into the Console.app log and filter to see what information you can get from there.

If it is enabled you should get the following on pointing to localhost within a browser


  It works!


So far so good, the server is running.

Now to navigate to the cgi-bin folder, if you used the scripts before then it should be mapped already in your configuration.

You could get


  Forbidden
  
  You don't have permission to access
  /cgi-bin/ on this server.


or an Internal Server Error if you went straight to the script

and you can chmod 755 the script and that should give you the correct permission to run it.

You can also check the access and error logs to see what's up

/var/log/apache2/access_log
/var/log/apache2/error_log  

/var is the symbolic link to private/var