在apache中安裝mod ruby和eruby

2021-03-31 08:56:57 字數 1484 閱讀 9056

1.簡介

mod_ruby在apache中嵌入了ruby直譯器,能使ruby cgi更快的執行。

eruby是eruby的實現,它把ruby**嵌入普通文字中,比如html中,從而類似asp,php等。

2.安裝

安裝apache: (1.3.29 )

./configure --prefix=/usr/local/apache --enable-module=rewrite --enable-module=so

make

make install

安裝mod_ruby:

cd mod_ruby-1.2.4

./configure.rb --with-apxs=/usr/local/apache/bin/apxs

make

make install

安裝eruby

cd eruby-1.0.5

./configure.rb 

make

make install

3.配置

加入如下內容:

loadmodule ruby_module /usr/local/apache/libexec/mod_ruby.so

# clearmodulelist

# addmodule mod_ruby.c

rubyrequire apache/ruby-run

# excucute files under /ruby as ruby scripts

sethandler ruby-object

rubyhandler apache::rubyrun.instance

options +execcgi

# execute *.rb files as ruby scripts

sethandler ruby-object

rubyhandler apache::rubyrun.instance

rubyrequire apache/eruby-run

#handle files under /eruby as eruby files

sethandler ruby-object

rubyhandler apache::erubyrun.instance

# handle *.rhtml files as eruby files

sethandler ruby-object

rubyhandler apache::erubyrun.instance

然後在web根目錄下建立乙個檔案test.rhtml,

內容是:

hello <%=" world "%>

然後在瀏覽器中開啟/test.rhtml,如果一切正常,應該出現:hello world.

在OpenBSD中安裝Apache

這幾天折騰openbsd。之前做過乙個虛擬機器,放在外網上做伺服器,結果宿主環境毀了,這個映象也就丟了。這次重安裝,竟然和重新弄完全一樣,大腦裡一點兒印象沒有。openbsd這個東西,不像centos和ubuntu,可以有非常好用的yum和apt get,它帶了個pkg add,也可以實現通過網路安...

apache在linux下安裝

主流linux系統版本基本上都整合了apache伺服器httpd,我們可以通過如下命令來檢視我們的作業系統上是否已經安裝了apache伺服器httpd 查詢服務是否啟動 停止服務 httpd k stop 解除安裝httpd伺服器 yum remove httpd yum安裝 yum install...

在Centos7中安裝apache原始碼包

實驗 為linux主機安裝應用程式 1 編譯安裝apache,並通過mozilla firefox瀏覽器驗證apache能否正常工作。1 解壓縮源 程式 2 配置apache指定安裝位置為 usr local apache 3 編譯並安裝apache程式 4 檢查apache安裝目錄是否建立 5 修...