1 Install Ruby
[root@www ~]#/etc/rc.d/init.d/httpd restart
Stopping httpd:[ OK ]
Starting httpd:[ OK ]
2 Create a test script and make sure if it works
[root@www ~]#chmod 705 /var/www/html/index.rb
[root@www ~]#yum -y install ruby
[root@www ~]#vi /etc/httpd/conf/httpd.conf
# line 796: add extension for ruby script
AddHandler cgi-script .cgi .pl .rb Stopping httpd:[ OK ]
Starting httpd:[ OK ]
2 Create a test script and make sure if it works
[root@www ~]#vi /var/www/html/index.rb
#!/usr/bin/ruby
print "Content-type: text/html\n\n"
print "<html>\n<body>\n"
print "<div style=\"width: 100%; font-size: 40px; font-weight: bold; text-align: center;\">\n"
print "Ruby Test Page<br />"
print Time.now.strftime('%Y/%m/%d')
print "\n</div>\n"
print "</body>\n</html>\n"
Comments
Post a Comment