I''ve been struggling to get a webservice I wrote into production with Rails 0.10, Apache 2.0.51 and the latest snap of fastcgi, and `gem install fcgi` Using http://wiki.rubyonrails.com/rails/show/FastCGI I have gotten *most* of the way, though I wasn''t sure if this needed updating for Rails 0.10 (especially in regard to the .htaccess stuff). My Apache document root is /var/www/index/. I created a directory /var/www/applications for my rails apps, and did a ln -s /var/www/index/applications /var/www/applications I got through all sorts of permission errors, but I am now left with a FileNotFound error. Lets say named my rails app "myapp" (i.e. did a `rails myapp` when I started). I have the following in my apache conf: FastCgiServer /var/www/index/applications/myapp/public/dispatch.fcgi -initial-env RAILS_ENV=production I''ve always used webrick in the past. When I wanted to access the app via a webrick server, I would http://myserver:3000/mycontroller/wsdl to get the wsdl specification for my webservice. Or, likewise, http://myserver:3000/mycontroller/myaction. What would be the url for my production line with apache? I''ve tried: http://myserver/applications/myapp/mycontroller/wsdl http://myserver/applications/myapp/mycontroller/myaction http://myserver/applications/mycontroller/myaction http://myserver/applications/mycontroller/ But nothing seems to work. I get 404 FileNotFound errors everytime. What would be the url I need to go to? Am I missing something here? Am I missing a necessary configuration step with this fancy new Routes thing? Thanks Matt
Belorion wrote:> I''ve been struggling to get a webservice I wrote into production with > Rails 0.10, Apache 2.0.51 and the latest snap of fastcgi, and `gem > install fcgi` > > Using http://wiki.rubyonrails.com/rails/show/FastCGI I have gotten > *most* of the way, though I wasn''t sure if this needed updating for > Rails 0.10 (especially in regard to the .htaccess stuff). > > My Apache document root is /var/www/index/. I created a directory > /var/www/applications for my rails apps, and did a > > ln -s /var/www/index/applications /var/www/applicationsMmmh should be ln -s /var/www/index/applications/myapp/public /var/www/myapp instead. And then, the url you''re looking would be http://myserver/myapp/mycontroller/wsdl and so on. Give it a try Victor
Sorry, the other way around: ln -s /var/www/applications/myapp/public /var/www/index/myapp Victor Jalencas wrote:> > > Belorion wrote: > >> I''ve been struggling to get a webservice I wrote into production with >> Rails 0.10, Apache 2.0.51 and the latest snap of fastcgi, and `gem >> install fcgi` >> >> Using http://wiki.rubyonrails.com/rails/show/FastCGI I have gotten >> *most* of the way, though I wasn''t sure if this needed updating for >> Rails 0.10 (especially in regard to the .htaccess stuff). >> >> My Apache document root is /var/www/index/. I created a directory >> /var/www/applications for my rails apps, and did a >> >> ln -s /var/www/index/applications /var/www/applications > > > Mmmh should be > > ln -s /var/www/index/applications/myapp/public /var/www/myapp > > instead. > > And then, the url you''re looking would be > > http://myserver/myapp/mycontroller/wsdl > > and so on. Give it a try > > Victor > _______________________________________________ > Rails mailing list > Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > http://lists.rubyonrails.org/mailman/listinfo/rails
Thank you for the reply. I worked with a user over IRC last night (quesera) to get things up and running. It turns out my main problem has to do with the fact that my .htaccess file is not being read. I''ve had to add the contents of the .htaccess file to my vhosts directive in my httpd.conf. Even though things are running now, it feels ... messy. Does anyone know why my .htaccess file is being ignored? The relevant part of my httpd conf (before I add the contents of my .htaccess file) is: <VirtualHost *:80> ServerName suvaservers.game-host.org DocumentRoot /var/www/applications/servers/public/ <Directory "/var/www/applciations/servers/public/"> AllowOverride All </Directory> (then, later) FastCgiServer /var/www/applications/myapp/public/dispatch.fcgi -initial-env RAILS_ENV=production And my .htaccess (in /var/www/applications/myapp/public/) file looks like: # General Apache options AddHandler fastcgi-script .fcgi AddHandler cgi-script .cgi Options +FollowSymLinks +ExecCGI # Redirect all requests not available on the filesystem to Rails RewriteEngine On RewriteRule ^$ index.html [QSA] RewriteRule ^([^.]+)$ $1.html [QSA] RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^(.*)$ /dispatch.fcgi?$1 [QSA,L] # In case Rails experiences terminal errors ErrorDocument 500 /500.html </VirtualHost> And yes, my .htaccess file is 644.
I finally got it working. And you won''t beleive how. First, I took the <Directory> out of within <VirtualHost>. This alone did not fix it though. Next, I replaced: AllowOverride All /var/www/applications/servers/public With AllowOverride All / This of course turned on overrides for *everything*, but I wanted to see if it would work. It did. So then I changed it to /var, then to /var/www, etc (with a httpd restart between eacah, of course). By the time I got to /var/www/applications/servers/public, it was still working. WORKING! UGH. Seriously, the only thing I did between the time it didn''t work and the time it did was step through each directory with AllowOverride All. So strange, so very strange. On Tue, 1 Mar 2005 08:44:49 -0600, Belorion <belorion-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Thank you for the reply. I worked with a user over IRC last night > (quesera) to get things up and running. It turns out my main problem > has to do with the fact that my .htaccess file is not being read. > I''ve had to add the contents of the .htaccess file to my vhosts > directive in my httpd.conf. > > Even though things are running now, it feels ... messy. Does anyone > know why my .htaccess file is being ignored? The relevant part of my > httpd conf (before I add the contents of my .htaccess file) is: > > <VirtualHost *:80> > ServerName suvaservers.game-host.org > DocumentRoot /var/www/applications/servers/public/ > > <Directory "/var/www/applciations/servers/public/"> > AllowOverride All > </Directory> > > (then, later) > FastCgiServer /var/www/applications/myapp/public/dispatch.fcgi > -initial-env RAILS_ENV=production > > And my .htaccess (in /var/www/applications/myapp/public/) file looks like: > > # General Apache options > AddHandler fastcgi-script .fcgi > AddHandler cgi-script .cgi > Options +FollowSymLinks +ExecCGI > > # Redirect all requests not available on the filesystem to Rails > RewriteEngine On > RewriteRule ^$ index.html [QSA] > RewriteRule ^([^.]+)$ $1.html [QSA] > RewriteCond %{REQUEST_FILENAME} !-f > RewriteRule ^(.*)$ /dispatch.fcgi?$1 [QSA,L] > > # In case Rails experiences terminal errors > ErrorDocument 500 /500.html > > </VirtualHost> > > And yes, my .htaccess file is 644. >