Ruby on Rails w/Passenger - just trying to get the basics setup...am I missing something?
I'm a rails novice, trying to set it up on a shared hosting site (Dreamhost). My domain there is configured to use Passenger, with a web root of myrubyapp/public.
Unfortunately, after setting RoR up, all I get is a directory listing of my "public" folder.
Here are the exact steps I took:
- 'rails new myrubapp'
- cd myrubyapp
- rake db:create (just using the basic SQLite get it to work - also tried with MySQL and no change)
At this point, the index.html in 'p开发者_Python百科ublic' works fine.
- 'rails generate controller home index'
- rm public/index.html
- modify config/routes.rb to uncomment and change the "root :to" line to point to home#index
- touch tmp/restart.txt (which I think is a dreamhostism - it tells Passenger to refresh its cache for this domain)
That's it. And now I get a directory listing in public instead of rails.
I'm kind of a rails novice, but I've been following the Getting Started Guide for rails.
Dreamhost has not been able to give me any clues. It's entirely possible I'm missing something. Unfortunately, the myrubyapp/log/production.log is a zero-length empty file (as is everything in myrubyapp/log). I don't know what the config is for Passenger/Apache, though Dreamhost says other customers are using rails on the same server with no problems.
This is rails 3, btw.
Anyone have a suggestion? Many thanks in advance.
It seems that Passenger does not run. Ask them to check whether it is indeed working for you, or check your control panel to see if it does. If you get a directory listing, it's pretty certain that passenger is not working. Your steps seem fine.
I can see two potentially problems right off the bat. First.. In the root :to line, you'll probably want to make sure you capitalize your class properly: 'Home#index' instead of 'home#index'. The other potential problem is that you don't really need to use db:create. db:migrate (for SQLite) will work just fine at most times. Though db:create should be fine too. The latter is more of a stylistic thing than something which is wrong.
As a side note, I used Dreamhost to host a Ruby project of mine for a while. They weren't bad, but the responses were really slow. If your code isn't being hit regularly, they basically 'background' your application and it ends up taking a while for it to spin back up when the next request comes in to it. I ended up with a VPS because of that. YMMV.
精彩评论