Configuring RoR/Apache -- help?
All right, I got FastCGI and RoR installed...
Should Rails apps really live in /home/user/ and not /home/user/public_html?
In the main server configuration I have:
AddHandler fastcgi-script .fcgi
Do I need to have <Directory> sections in the <VirtualHost> section for each Rails app?
The Agile book talks about a different configuration for FastCGI, but can that <IfModule> section be used within, say, my <Directory> tags in httpd.conf, or in an .htaccess file?
What else do I need to do to get this to work?
I don't know the specifics for this...
But however, I suggest you ask at http://www.ruby-forum.com/ as it is a forum in sync with the mailing list for ruby developers.
Best of luck
Yes, IfModule can be used within the Directory tags or in .htaccess.
Of course, you shouldn't need an IfModule by the time it gets to your app's .htaccess, assuming you have FastCGI set up correctly in the first place.
The line in Agile is:
FastCGIServer /path/to/app/public/dispatch.fcgi \
-initial-env RAILS_ENV=production \
- processes 15 -idle-timeout 60
I wouldn't want that in my main server configuration, right? I would think ideally I would want that in the .htaccess file, out of httpd.conf entirely, so that users could handle it themselves.
Anyway, I got to the Welcome Aboard page (public/index.html) but anything requiring dispatch.fcgi is taking me to 500.html.
The log says things like:
Recognition failed for "/dispatch.fcgi/"
You shouldn't be trying to access dispatch.fcgi in the browser.
Is there a fastcgi.crash.log file anywhere? What does that say?
I wasn't trying to access dispatch.fcgi directly... that was from accessing myurl.com/railstest/testcontroller
I see that when I change .htaccess to use regular cgi instead of fastcgi, RoR seems to be working... I can access that same url and see what I expect to see ("hello world" )
There isn't a fastcgi.crash.log in the application log folder. Anywhere else I might look for it?
Maybe in Apache's logs directory? Also look for a file called error.log in the Apache logs directory, there may be some information there.
Couldn't write to "/home/em/public_html/railstest/public/../config/../log/fastcgi.crash.log":
It should be /home/em/public_html/railstest/../log/
Not sure how to help it... I set the RewriteBase in .htaccess if that has anything to do with it.
chmod your /log directory to 666 so the web server can write to it. While you're at it, chmod all the files in your /public directory to 755.
Ok, created the log it was looking for... only thing in it was a message about fastcgi starting... no errors.
Deleted the error_log for my app to start fresh, reloaded the test url, and this is the entire error_log after:
file /home/em/public_html/railstest/../config/../tmp/sessions//ruby_sess.0ba7799c3c6dd98b not readable
Look in the /tmp/sessions folder of your Rails app. What are the permissions? Set them to something readable/writable.
After doing chown -R nobody:nobody /path/to/rails/app/*
...it all seems to be working so far... weird.
Rails is very peculiar about permissions
Originally Posted by DevilBear
Thanks! I'm going to put this away for tonight. I'm sure I'll have more questions soon.
Oh, I do notice that trying to access myurl.com/railsapp doesn't work ("Bad request") but myurl.com/railsapp/ with a trailing slash does.
Also, what if I want userdomain.com/ to point to railsapp/public, not userdomain.com/subdirectory ?
Set your domain/VirtualHost's DocumentRoot to the rails app's /public/ directory.
Originally Posted by DevilBear