I changed the file permissions to 644.
~/ruby_programs$ chmod 644 cgi.cgi
~/ruby_programs$ ls -al cgi.cgi
-rw-r--r-- 1 7stud staff 102 Nov 13 15:50 cgi.cgi
File permissions are displayed as follows:
First character is - or d: - means file, d means directory
Then there are three sets of three characters indicating permissions for owner, group and other:
r = readable
w = writable
x = executable
644 produces the permissions:
rw-r--r--
which are equivalent to:
owner: rw- (read, write)
group: r-- (read only)
other: r-- (read only)
You don't have to know who is an owner, or who is part of a group, or who falls in the other category to recognize that no one has permission to execute the file. You need to do this:
~/ruby_programs$ chmod a+x cgi.cgi #=>all + x => give execute permissions to everyone
~/ruby_programs$ ls -al cgi.cgi
-rwxr-xr-x 1 7stud staff 102 Nov 13 15:50 cgi.cgi
Now the permissions are:
owner: rwx
group: r-x
other: r-x
which means that now anyone can execute the file.
All it displays on the URL is my source code from above.
If you haven't already done so, try giving your ruby file a .cgi extension. Then use this code:
#!/usr/bin/env ruby
puts "Content-type: text/html\n\n"
puts "<html><body>Hello, Ruby!</body></html>"
Are you sure ruby is installed on your school's server?
.cgiextension.