facebook twitter hatena line google mixi email

Ruby/apacheで表示

提供: 初心者エンジニアの簡易メモ
移動: 案内検索

apacheのhttpd.conf設定

# AddHandler cgi-script .cgi .pl .asp
AddHandler cgi-script .cgi .pl .asp .rb

helloworld.rb

#!/usr/bin/ruby
print "Content-type: text/html\n\n";
puts "Hello World"

railsの設定

<VirtualHost *:80>
  ServerName ruby.localhost
  DocumentRoot "D:/home/test/ruby/helloworld/public"
  HostNameLookups off
  UseCanonicalName on
  <Directory "D:/home/test/ruby/helloworld/public">
    Options FollowSymLinks Includes ExecCGI
    AllowOverride All
    Allow from All
  </Directory>
</VirtualHost>