I''m running rails on RedHat ES3 managed by Plesk with Apache/FastCGI. I''ve followed the directions here: http://wiki.rubyonrails.com/rails/pages/HowtoInstallAndRunRubyOnRailsOnPlesk And got everything working, but my application refuses to run in Production mode. It runs in development mode despite the fact that I''ve set: FastCgiServer /home/httpd/vhosts/USER/httpdocs/rails/dispatch.fcgi -idle-timeout 120 -initial-env RAILS_ENV=production -processes 4 in fastcgi.conf and switched the .htaccess file over to: RewriteRule ^(.*)$ dispatch.fcgi [QSA,L] What else could possibly be forcing it over to development mode? -- Posted via http://www.ruby-forum.com/.
Ryan Williams
2006-Apr-11 16:12 UTC
[Rails] still in development mode/routing errors galore
I''m still not finding a solution on this issue. I have confirmed that the application is indeed running in development mode by putting <%= debug(RAILS_ENV) %> in one of my views. Also, none of my images are loading. If I try to access them directly, I get a routing error. Looking at the development log (production log is of course empty), I''m getting routing errors on anything in the public directory (javascript libs, stylesheets, images, etc.). This leads me to believe that the public directory is not being recognized, which would also mean that the .htaccess file with the dispatch.fcgi rule is being ignored. I''ve checked owner and permissions on /public and everything in it and all seems right. I don''t see how the application would work at all without finding the .htaccess. And, based on the fast response, the app certainly seems to be using fastCGI. Is there a way to verify this with an ENV variable or something? FWIW, I also created a test application on the server and it too will not run in production mode. Definitely seems to be a configuration issue with FastCGI somewhere, but I can''t figure out what. Any suggestions would be greatly appreciated. RedHat el3 Plesk 7.5.4 Ruby 1.8.4 Rails 1.1.2 (and tried 1.1.1 from vendor freeze) -- Posted via http://www.ruby-forum.com/.
Wes Gamble
2006-Apr-11 16:17 UTC
[Rails] Re: still in development mode/routing errors galore
Are you sure that your fastcgi.conf file is being included by the main Apache httpd.conf file? Wes Ryan Williams wrote:> I''m still not finding a solution on this issue. I have confirmed that > the application is indeed running in development mode by putting <%= > debug(RAILS_ENV) %> in one of my views. Also, none of my images are > loading. If I try to access them directly, I get a routing error. > Looking at the development log (production log is of course empty), I''m > getting routing errors on anything in the public directory (javascript > libs, stylesheets, images, etc.). This leads me to believe that the > public directory is not being recognized, which would also mean that the > .htaccess file with the dispatch.fcgi rule is being ignored. I''ve > checked owner and permissions on /public and everything in it and all > seems right. I don''t see how the application would work at all without > finding the .htaccess. And, based on the fast response, the app > certainly seems to be using fastCGI. Is there a way to verify this with > an ENV variable or something? > > FWIW, I also created a test application on the server and it too will > not run in production mode. Definitely seems to be a configuration issue > with FastCGI somewhere, but I can''t figure out what. > > Any suggestions would be greatly appreciated. > > RedHat el3 > Plesk 7.5.4 > Ruby 1.8.4 > Rails 1.1.2 (and tried 1.1.1 from vendor freeze)-- Posted via http://www.ruby-forum.com/.
Ryan Williams
2006-Apr-11 17:26 UTC
[Rails] Re: still in development mode/routing errors galore
Wes Gamble wrote:> Are you sure that your fastcgi.conf file is being included by the main > Apache httpd.conf file?Well, it certainly *seems* to be. I don''t see how the app was running at all otherwise. That''s what I''ve been trying to confirm. Oddly, I was able to get the simple test app running in production mode finally (after a few server and apache restarts), but the main app now will no longer respond at all. The browser simply spins with a "Waiting for www.mydomain.com" message. And the issue isn''t with the domain itself, since .html is being served from other directories. Frustrating. -- Posted via http://www.ruby-forum.com/.
Ryan Williams
2006-Apr-11 18:04 UTC
[Rails] Re: still in development mode/routing errors galore
Okay, we have confirmed with our host that FastCGI is indeed working. My host checked for syntax errors with "httpd -t". They also created a Redirect to ensure that it was working. So, that''s not the issue. Regardless, even a simple test app for whatever reason will not see anything in /public. The index.html produces a 404 and I tried to directly call the rails.png that installs by default with the same result. It''s public is recursively permissioned 777 and chowned correctly. Just for a laugh, I even modified the 404.html which it IS showing me and the changes were indeed output. I''m at a total loss. Maybe I should bump this to a new post at this point. -- Posted via http://www.ruby-forum.com/.
Steve Koppelman
2006-Apr-11 18:29 UTC
[Rails] Re: still in development mode/routing errors galore
Since this looks like an Apache configuration error, please post more than two lines of the relevant parts of your Apache conf files. The section regarding configuration of your fcgi module and the entire virtualhost block for your app would be a good place to start. Also, are you deploying a simple copy of your application''s diorectory tree or are you deploying with Capistrano? Ryan Williams wrote:> Okay, we have confirmed with our host that FastCGI is indeed working. My > host checked for syntax errors with "httpd -t". They also created a > Redirect to ensure that it was working. So, that''s not the issue. > > Regardless, even a simple test app for whatever reason will not see > anything in /public. The index.html produces a 404 and I tried to > directly call the rails.png that installs by default with the same > result. It''s public is recursively permissioned 777 and chowned > correctly. Just for a laugh, I even modified the 404.html which it IS > showing me and the changes were indeed output. I''m at a total loss. > Maybe I should bump this to a new post at this point.-- Posted via http://www.ruby-forum.com/.
Have you checked access rights for you DBMS in production mode ? Is database.yml correctly configured ? -- Posted via http://www.ruby-forum.com/.
Ryan Williams
2006-Apr-11 19:25 UTC
[Rails] Re: still in development mode/routing errors galore
Steve Koppelman wrote:> Since this looks like an Apache configuration error, please post more > than two lines of the relevant parts of your Apache conf files. The > section regarding configuration of your fcgi module and the entire > virtualhost block for your app would be a good place to start.This is a Plesk managed system, so it complete controls the vhost blocks and there''s no changing them. The FastCGI config is included via a conf file in /etc/httpd/conf.d/fastcgi.conf: User apache Group apache LoadModule fastcgi_module /usr/lib/httpd/modules/mod_fastcgi.so <IfModule mod_fastcgi.c> FastCgiWrapper on FastCgiConfig -idle-timeout 900 FastCgiIpcDir /tmp/fastcgi_ipc/ AddHandler fastcgi-script .fcgi .rb FastCgiServer /home/httpd/vhosts/my1stdomain.com/httpdocs/rails/dispatch.fcgi -idle-timeout 120 -initial-env RAILS_ENV=production -processes 4 FastCgiServer /home/httpd/vhosts/my2nddomain.com/httpdocs/myapp/dispatch.fcgi -idle-timeout 120 -initial-env RAILS_ENV=production -processes 4 </IfModule> in the httpd error_log I''m getting TONS of these: [Tue Apr 11 13:59:19 2006] [warn] FastCGI: server "/home/httpd/vhosts/mydomain.com/httpdocs/rails/dispatch.fcgi" has failed to remain running for 30 seconds given 3 attempts, its restart interval has been backed off to 600 seconds for either of the apps. then, in the suexec_log: [2006-04-11 15:09:19]: uid: (apache/apache) gid: (apache/apache) cmd: dispatch.fcgi [2006-04-11 15:09:19]: crit: cannot run as forbidden uid (48/dispatch.fcgi) The test app at my1stdomain.com/rails/ at least responds, though nothing in public is accessible. The actual app that I''m trying to deploy at my2nddomain.com/myapp/ won''t even respond. The test app was created live on the server. The main app that I''m trying to deploy was a copy of the directory tree which was tarred, unpacked, chowned and chmoded appropriately. The directories reside behind the webroot with a symbolic link in the webroot pointing back at ../myapp/public and are also chowned and chmoded appropriately. -- Posted via http://www.ruby-forum.com/.
Ryan Williams
2006-Apr-11 19:26 UTC
[Rails] Re: still in development mode/routing errors galore
Nuno wrote:> Have you checked access rights for you DBMS in production mode ? Is > database.yml correctly configured ?Yes. They are correct. Even if they weren''t though, Rails would throw me errors saying such. This isn''t responding at all. -- Posted via http://www.ruby-forum.com/.
Ryan Williams
2006-Apr-11 22:50 UTC
[Rails] Re: still in development mode/routing errors galore
>From my hosting provider:It appears that the script is attempting to be executed as either apache48 or root [2006-04-11 17:28:30]: uid: (root/root) gid: (0/0) cmd: dispatch.fcgi [2006-04-11 17:28:30]: crit: cannot run as forbidden uid (0/dispatch.fcgi) SUExec does not allow this, the script must be executed as the user/group that owns that domain. I''m not sure where this is configured in ruby on rails but you should check to be sure that it''s execing as the user that owns the file. --- Anyone? -- Posted via http://www.ruby-forum.com/.
Al Evans
2006-Apr-12 16:11 UTC
[Rails] Re: still in development mode/routing errors galore
Ryan Williams wrote:> From my hosting provider: > > It appears that the script is attempting to be executed as either > apache48 or root > > [2006-04-11 17:28:30]: uid: (root/root) gid: (0/0) cmd: dispatch.fcgi > [2006-04-11 17:28:30]: crit: cannot run as forbidden uid > (0/dispatch.fcgi) > > > SUExec does not allow this, the script must be executed as the > user/group that owns that domain. > > I''m not sure where this is configured in ruby on rails but you should > check to be sure that it''s execing as the user that owns the file. > > --- > > Anyone?uh, chown -R your_user.your_group your_app_dir Doesn''t seem likely, but it''s the only thing that came to mind. Here''s what suexec is supposed to be checking: http://httpd.apache.org/docs/1.3/suexec.html --Al Evans -- Posted via http://www.ruby-forum.com/.
Ryan Williams
2006-Apr-12 16:46 UTC
[Rails] Re: still in development mode/routing errors galore
> uh, chown -R your_user.your_group your_app_dir > > Doesn''t seem likely, but it''s the only thing that came to mind. > > Here''s what suexec is supposed to be checking: > > http://httpd.apache.org/docs/1.3/suexec.htmlThanks Al. Actually, I had tired that (several times). Most of the suexec issues were with regard to not having CGI enabled on the domain in the Plesk manager. That said, I still have no access to the public directory, and FastCGI is spawning all kinds of orphaned processes. I''m going to try switching to mod_fcgid and see if that helps. Otherwise, I think I''ll be begging the guys at http://www.railsmachine.com to go ahead and launch their hosting service! -- Posted via http://www.ruby-forum.com/.
Steve Koppelman
2006-Apr-12 18:40 UTC
[Rails] Re: still in development mode/routing errors galore
Plessk, huh? apache48, huh? 1. Is this a non-VPS shared hosting account? If so, in all likelihood stuff is going to run only under *your* user and group(s). 2. Where did User and Group "apache" come from? Are they a user and group you use, or that you created? Can you create a file and chown it to "apache"? 3. Do you do suexecs to users and groups you specify in any non-rails apps you have on this host? If so, are those the user and group you get on files that those apps write to, say, your temp dir? Ryan Williams wrote:> Steve Koppelman wrote: >> Since this looks like an Apache configuration error, please post more >> than two lines of the relevant parts of your Apache conf files. The >> section regarding configuration of your fcgi module and the entire >> virtualhost block for your app would be a good place to start. > > This is a Plesk managed system, so it complete controls the vhost blocks > and there''s no changing them. The FastCGI config is included via a conf > file in /etc/httpd/conf.d/fastcgi.conf: > > User apache > Group apache > LoadModule fastcgi_module /usr/lib/httpd/modules/mod_fastcgi.so...:: snip :: -- Posted via http://www.ruby-forum.com/.
Ryan Williams
2006-Apr-12 19:01 UTC
[Rails] Re: still in development mode/routing errors galore
> 1. Is this a non-VPS shared hosting account? If so, in all likelihood > stuff is going to run only under *your* user and group(s).This is a dedicated server. We simply use Plesk to allow our hosting clients to manage their virtual hosting accounts. So, I have complete access to the server config within reason (thing that won''t adversly effect Plesk!).> 2. Where did User and Group "apache" come from? Are they a user and > group you use, or that you created? Can you create a file and chown it > to "apache"?Literally... here: http://wiki.rubyonrails.com/rails/pages/HowtoInstallAndRunRubyOnRailsOnPlesk The frustrating thing being that others have obviously had this working. There was also supposedly a detailed three-part guide on setting this up at http://www.soapboxconfessional.com, but the guy has since killed his server.> 3. Do you do suexecs to users and groups you specify in any non-rails > apps you have on this host? If so, are those the user and group you get > on files that those apps write to, say, your temp dir?Yes, they are all apache:apache as well... without issue. -- Posted via http://www.ruby-forum.com/.
Ryan Williams
2006-Apr-12 19:05 UTC
[Rails] Re: still in development mode/routing errors galore
And there is now a new thread that clarifies what''s going on with this a little better here: http://www.ruby-forum.com/topic/61866 Please take a look... I would really appreciate it. -- Posted via http://www.ruby-forum.com/.