【发布时间】:2013-01-14 18:34:16
【问题描述】:
这是我的“etc/hosts”文件中的内容:
127.0.0.1 本地主机
127.0.1.1 gotqn-系统-产品-名称
127.0.0.1 depot.yourhost.com
这是我在 apache2.conf 文件中添加的内容:
<VirtualHost *:80>
ServerName depot.yourhost.com
DocumentRoot "/home/gotqn/Aptana Projects/depot/public/"
<Directory "/home/gotqn/Aptana Projects/depot/public">
AllowOverride all
Options -MultiViews
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
当我输入 http://localhost/ 时,我的浏览器会列出“var\www”文件夹中的所有文件,当我输入 http://depot.yourhost.com/ 时 它显示以下错误:
很抱歉,出了点问题。
我检查了我的 rails 应用程序的 production.log 文件,它说:
连接到database.yml指定的数据库
在 2013-01-13 20:32:41 +0200 处理 127.0.0.1 开始 GET "/" 通过 StoreController#index 作为 HTML Completed 500 Internal Server Error 3毫秒
ActiveRecord::StatementInvalid(找不到表“购物车”):
app/controllers/application_controller.rb:46:inrescue in current_cart' app/controllers/application_controller.rb:44:incurrent_cart' app/controllers/store_controller.rb:11:in `index'
我认为我的数据库配置有问题,因为表存在但找不到。
无论如何,我的问题是主机文件如何知道“depot.yourhost.com”意味着打开 rails 应用程序,而“localhost”确实列出了我的“var\www”文件夹 - 我认为 RoR 正在使用端口 3000 .
为什么80端口没有冲突?
【问题讨论】:
-
看起来您在 Apache 中运行了 mod_passenger?
-
@MichaelBerkowski 是的,正确的。这就是我正在使用的 - 乘客。
标签: ruby-on-rails-3 apache hosts