Hello everybody,
I was able to set up Ruby 1.8.4 on Rails, using Apache 2.2.2 and MySql
5.0.22 and if you go to http://spagnolo.troccoli.it you have the nice
"Welcome abroad" page.
I have created a table (modes) with mysql
CREATE TABLE `modes` (
`id` INTEGER UNSIGNED NOT NULL AUTO_INCREMENT,
`description` VARCHAR(45) NOT NULL DEFAULT '''',
PRIMARY KEY(`id`)
)
ENGINE = InnoDB;
Then I have generated the controller and the model for it with
ruby script/generate controller Mode
ruby script/generate model Mode
Then I changed the mode_controller.rb as
class ModeController < ApplicationController
scaffold :mode
end
But, if I go to spagnolo.troccoli.it/mode/new I don''t get what I
expected but a 404 "The page cannot be found" error.
Apache serves my website too, so my virtual hostes are defined as
follows:
NameVirtualHost *
<VirtualHost *:*>
ServerAdmin giulio@troccoli.it
DocumentRoot /home/webmaster/troccoli.it/www
ServerName www.troccoli.it
ErrorLog logs/troccoli.it-error_log
CustomLog logs/troccoli.it-access_log common
</VirtualHost>
<VirtualHost *:*>
ServerAdmin giulio@troccoli.it
DocumentRoot /home/webmaster/troccoli.it/spagnolo/public
ServerName spagnolo.troccoli.it
ErrorLog logs/spagnolo-error_log
CustomLog logs/spagnolo-access_log common
<Location /journal>
RewriteEngine On
# Let Apache handle purely static files like images by itself.
RewriteCond %{REQUEST_FILENAME} !-f
# Send Everything else to Rails
RewriteRule ^(.*)$ dispatch.fcgi [QSA,L]
</Location>
<Directory /home/webmaster/troccoli.it/spagnolo/journal>
# ExecCGI is required for mod_fcgid to work.
Options Indexes FollowSymLinks ExecCGI
# Disable .htaccess files.
AllowOverride None
Order allow,deny
Allow from all
# This tells mod_fcgid to run the dispatch.fcgi script as a
FastCGI
AddHandler fcgid-script .fcgi
</Directory>
</VirtualHost>
Someone suggested that I used the IP address in the VirtualHost tag, but
I can''t. If my server connection goes dow for any reason, the router is
set to automatically connect again, thus possibly getting a different IP
address.
The same person suggested to move the Rewrite stuff outside the Location
element, but that didn''t work (and actually I couldn''t get the
"Welcome
abroad" page anymore).
Any ideas or suggestions on why http://spagnolo.troccoli.it/mode/new
does not work?
Giulio
--
Posted via http://www.ruby-forum.com/.
Giulio Troccoli wrote:> I was able to set up Ruby 1.8.4 on Rails, using Apache 2.2.2 and MySql > 5.0.22 and if you go to http://spagnolo.troccoli.it you have the nice > "Welcome abroad" page.Hi Giulio, When you click on the "about your applications environment" link on the page, do you get anything ? That will tell you if you''re able to get through fcgi and hit some actual rails/ruby code (the welcome page is static). A. -- Posted via http://www.ruby-forum.com/.
Alan wrote:> Hi Giulio, > > When you click on the "about your applications environment" link on the > page, do you get anything ? That will tell you if you''re able to get > through fcgi and hit some actual rails/ruby code (the welcome page is > static). > > A.Alan, no, I don''t have anything. It says Not Found The requested URL /rails/info/properties was not found on this server. So what did I do wrong? Last time I used RoR I didn''t do much, just set it up, generate the controllers and add the scaffold instruction. It seems that''s not enough anymore... G -- Posted via http://www.ruby-forum.com/.
Is there anyone out there who could help me? I have a lot of work to do but there''s no point on doing it if I can''t see anything? Why can''t I? Giulio -- Posted via http://www.ruby-forum.com/.
Giulio Troccoli wrote:> Is there anyone out there who could help me? > > I have a lot of work to do but there''s no point on doing it if I can''t > see anything? Why can''t I? > > GiulioThats way to big a question to answer simply. It looks like Apache isn''t hitting the fcgi at all. Have you tried running the app with webrick ? There''s really no need to deal with all the apache/fcgi stuff this early in the game. from your raisl app dir, type ''script/server''. This will run your app using Webrick on port 3000. You should now be able to go to http://my.web.server:3000/ to see the application. If you eget the welocme page and can successfully get the ''environment'' link there working, your app is fine and will work in development. This should tide you over for a while until you actually need to deal with production deployment. Alan -- Posted via http://www.ruby-forum.com/.
Alan Francis wrote:> Thats way to big a question to answer simply. It looks like Apache > isn''t hitting the fcgi at all.Sorry, I was being melodramatic :-)> Have you tried running the app with webrick ? There''s really no need to > deal with all the apache/fcgi stuff this early in the game.You were right, the problem seems to be with Apache. I ran WEBrick and everything works now. BUT... The reason I want to use Apache are mainly two. One is that so I have only one web server running and that keeps things clear and tidy. The second reason is that I don''t want, if it''s possible, to have to type the port number (spagnolo.troccoli.it:3000). I cannot obviously start WEBrick on port 80 as Apache is already listening to that. If there is another way to achieve the same result (i.e. not typing the port number) I''ll be happy to try it out. Giulio -- Posted via http://www.ruby-forum.com/.