Ubuntu 15.04
Sponsored Link

Use Ruby Scripts2015/05/25

 
Install Ruby to use Ruby Scripts as CGI.
[1] Install Ruby.
root@www:~#
apt-get -y install ruby
root@www:~#
vi /etc/apache2/mods-enabled/mime.conf
# line 219: add extension for ruby script

AddHandler cgi-script .cgi .pl
.rb
root@www:~#
systemctl restart apache2

[2] Create a Ruby test page and access to it with web browser. It's OK if following page is shown.
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" 

root@www:~#
chmod 705 /var/www/html/index.rb

Matched Content