I've written a RoR app and trying to deploy it.

So, the following problem shows up on my Linode: Browser page shows just the code I wrote in index.html.haml not a page as supposed. When I try to use index.html instead I get a valid rendered page. When I try to use index.html.erb it renders partially (something, e.g. input, renders but there are a lot of strings of erb code and no css)

At the same time, my local server (based on OS X) works good and I see my haml-based pages as normal rendered html-pages. (I'm getting nuts!)

Please help me to understand how to fix that.

Ubuntu 12.04, Apache 2.22, ruby 2.0.0, rails 3.2.12, haml 4.0.5, haml-rails 0.4

Thanks in advance!

UPD Gemfile

source 'https://rubygems.org'

gem 'rails', '3.2.12'

# Bundle edge Rails instead:
# gem 'rails', :git => 'git://github.com/rails/rails.git'

gem 'mysql2'
gem 'devise', '3.0.3'
gem 'debugger'


group :assets do
  gem 'coffee-rails', '~> 3.2.1'
  gem 'uglifier', '>= 1.0.3'
  gem 'therubyracer', :platform => :ruby
end

gem 'less-rails', '~> 2.2.6'
gem 'sass-rails', '~> 3.2.3'
gem 'twitter-bootstrap-rails', '2.2.4'
gem 'friendly_id', '~> 3.2'

gem 'jquery-rails'
gem 'haml', '~> 4.0.0'
gem 'cancan'
gem 'haml-rails'
gem 'rails-i18n', '~> 3.0.0.pre'
gem 'i18n-js'
gem 'obscenity'
gem 'thin'
gem 'will_paginate-bootstrap'
gem 'nifty-generators', :group => :development
gem 'rails_12factor'
gem 'mocha', :group => :test

group :development do
  gem 'sqlite3'
  gem 'capistrano', '2.15.5'
  #gem 'capistrano-rails'
  #gem 'capistrano-bundler'
  #gem 'capistrano-rvm'
  #gem 'rvm1-capistrano3', :require => false
end

gem 'net-ssh', '2.7.0'

gem 'foreman'

Apache config

<VirtualHost *:80>
  # Admin email, Server Name (domain name), and any aliases
  ServerAdmin admin@mysite.com
  ServerName  www.mysite.com
  ServerAlias mysite.com
  Options Indexes ExecCGI FollowSymLinks
  PassengerResolveSymlinksInDocumentRoot on
  RailsEnv production
  RailsBaseURI /

  # Index file and Document Root (where the public files are located)
  DirectoryIndex index.html index.php index.html.erb index.html.haml
  DocumentRoot /home/deploy/public/mysite.com/public/app/views/home

  # Log file locations
  LogLevel warn
  ErrorLog  /home/deploy/public/mysite.com/log/error.log
  CustomLog /home/deploy/public/mysite.com/log/access.log combined
</VirtualHost>
有帮助吗?

解决方案

You should definitelly refer to some manual about running rails app on thin + apache; this one should work for you:

http://www.rackspace.com/knowledge_center/article/ubuntu-apache-rails-and-thin

Right now you are just serving static files with apache.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top