我是Ruby的新手,我之前曾在PHP中涉獵過。我的Windows 10 PC上安裝了EasyPHP-DevServer-14.1VC9,我可以輕鬆地從服務器運行PHP應用程序。我在我的機器上安裝了Ruby和Rails前幾天和下面的代碼添加到我的EasyPHP Apache服務器使用EasyPHP部署Ruby應用程序
<IfModule dir_module>
DirectoryIndex index.html index.shtml index.wml index.pwml index.php index.php3 index.php4 index.php5 index.cgi index.rb index.erb
</IfModule>
<virtualHost 127.0.0.1:3001>
ServerName rails
DocumentRoot "C:/Program Files (x86)/EasyPHP-DevServer-14.1VC9/data/localweb/apps"
<Directory "C:/Program Files (x86)/EasyPHP-DevServer-14.1VC9/data/localweb/apps">
Options ExecCGI FollowSymLinks
AllowOverride all
Allow from all
Order allow,deny
AddHandler cgi-script .cgi
AddHandler fastcgi-script .fcgi
</Directory>
</VirtualHost>
的httpd.conf文件但是,當我開始的EasyPHP,然後轉到瀏覽器並嘗試運行指標包含以下內容的.erb文件(我試圖測試部署) - 我只是看到輸出字面和ruby代碼不會執行。 Ruby代碼被打印爲一個字符串。
的index.erb
內容:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Expense Management: Home</title>
</head>
<body>
<h1>Welcome to Expense Management</h1>
<td>
<tr>
Let's run some ruby code: <%= 4+5 %>
</tr>
<tr>
Check back later.
</tr>
</td>
</body>
輸出我得到的是這樣的:
Welcome to Expense Management
Let's run some ruby code: <%= 4+5 %> Check back later.
如果你打算做Rails,使用EasyPHP這樣的工具是完全矛盾的。 Rails不僅僅是一堆隨機腳本,還有一個比Perl或PHP更正式的部署過程。 – tadman