dreamhost使用eruby

Eruby From DreamHost

Eruby is a way to embed ruby in HTML.
1 Setup
2 Testing
3 See Also
4 External Links

Setup

First, obtain a copy of eruby. This is most easily done by using SSH and simply copying /usr/bin/eruby. Name the file eruby.cgi and stick it in the root of the site you’d like to enable ruby on.

cp /usr/bin/eruby ~/mysite.com/eruby.cgi

Next, create or edit an .htaccess file. There are two important things to do: make sure .rhtml files get parsed by eruby and make sure apache knows to look for an index.rhtml.

DirectoryIndex index.rhtml index.html index.htm
AddHandler rubypage .rhtml
Action rubypage /eruby.cgi

If you’re lazy, you can simply download a functional .htaccess.

wget http://covracer.com/projects/eruby/htaccess -O ~/mysite.com/.htaccess

Testing

You can use the following simple test to make sure everything is working.

You can also download the test page.

wget http://covracer.com/projects/eruby/test.rhtml

发表您的评论

提示:如果你刚刚提交过评论,但是还没有被显示出来,请点击这里刷新一下: 刷新评论