0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

【質問】Rubyのスクリプトが動かない(Apache)

Last updated at Posted at 2014-12-13

初めまして。手の打ちようが予想もつかず、動けません。
解決方法をご存じの方、お教えください。宜しくお願いします。

環境

Vagrant(CentOS 7.0) + rbenv + ruby-buildでruby環境を構築

事象

Apache経由でrubyスクリプトを見ると、500 Internal Server Errorがでてしまいます。
質問用イラスト.png

ex01.rb
# !/usr/local/bin/ruby
print <<E
content-Type: text/html
<! DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<HTML>
<HEAD>
<TITLE>Example 01</TITLE>
</HEAD>
<BODY>
<P>Hello World!</P>
</BODY>
</HTML>
E    
/var/www/html/.htaccess

Options +ExecCGI
AddHandler cgi-script .cgi
AddHandler cgi-script .rb

経過

rb
which ruby
/usr/local/rbenv/shims/ruby
rbenv
which rbenv
/usr/local/rbenv/bin/rbenv
  • パーミッションを755に変更してみました。
ls -la /usr/local/bin/ruby
lrwxrwxrwx. 1 root root 27 Dec 12 23:28 /usr/local/bin/ruby -> /usr/local/rbenv/shims/ruby
  • apacheのhttpd.confのusergroupのapacheをvagrantに変えてもみました。

  • /etc/selinux/configで、SELinuxを無効にしてみました。

エラーに変化はありません。

0
0
8

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?