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 [email protected]
DocumentRoot /home/webmaster/troccoli.it/www
ServerName www.troccoli.it
ErrorLog logs/troccoli.it-error_log
CustomLog logs/troccoli.it-access_log common
<VirtualHost :>
ServerAdmin [email protected]
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]
<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
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