RoR on WinXP/Apache

G

gander

I'm trying to get typo up on my local box (WinXP).

When I hit localhost, I get the "Congratulations, you've put Ruby on
Rails!" screen.

When I hit localhost/typo, I get:

-------------------------------
Routing Error

No route for path: "typo"

Failure reasons:

1. <ActionController::Routing::Route ":controller/service.wsdl" when
{:action=>"wsdl"}> failed because no controller found at subpath typo
2. <ActionController::Routing::Route ":controller/:action/:id" ||
{:id=>nil, :action=>"index"}> failed because no controller found at
subpath typo
-------------------------------
I'm a triple newbie: ruby, rails, and apache so I don't even know where
to start.

Here's my take:
1. The request is getting passed from Apache to Rails because the error
is showing "ActionController" stuff.

2. It may be some mis-config in Apache since it can't find the proper
subpath. Here's what I have related to typo in httpd.conf:

<VirtualHost *>
ServerName typo
DocumentRoot /www/webroot/typo/public
<Directory /www/webroot/typo/public/ >
Options ExecCGI FollowSymlinks
AllowOverride all
Allow from all
Order allow,deny
</Directory>
</VirtualHost>

For context, I also have in httpd.conf:

DocumentRoot "C:/www/webroot"

On my hard drive, the path to typo is:

C:\www\webroot\typo


If I serve it up through WEBrick, I get:

--------------------------------------
Routing Error

Illegal controller path for route default: articles
--------------------------------------

This leads me to believe it may also be a problem in config/routes.rb,
which reads, in part:

# default
map.connect '', :controller => 'articles'

Can anyone shed some light and point me in the right direction? I've
really tried to RTFM. Honest.

Thanks,

G
 
C

Craig Beck

I'm trying to get typo up on my local box (WinXP).

When I hit localhost, I get the "Congratulations, you've put Ruby on
Rails!" screen.

When I hit localhost/typo, I get:

That sounds correct, as there is no "typo" controller in typo...
however with a regular typo install there shouldn't be any index.html
page (the "Congrats..." page). When you "hit localhost" what exactly
is the url you are using? http://localhost? if so, then you are
seeing the correct directory (typo/public) being served to you...
although I don't know why you'd have the "Congrats you're on Rails"
page.
Failure reasons:

1. <ActionController::Routing::Route ":controller/service.wsdl"
when
{:action=>"wsdl"}> failed because no controller found at subpath typo
2. <ActionController::Routing::Route ":controller/:action/:id" ||
{:id=>nil, :action=>"index"}> failed because no controller found at
subpath typo
-------------------------------
I'm a triple newbie: ruby, rails, and apache so I don't even know
where
to start.

Here's my take:
1. The request is getting passed from Apache to Rails because the
error
is showing "ActionController" stuff.

Sounds like that's the case
2. It may be some mis-config in Apache since it can't find the proper
subpath. Here's what I have related to typo in httpd.conf:

Sound likely...
<VirtualHost *>
ServerName typo
DocumentRoot /www/webroot/typo/public
<Directory /www/webroot/typo/public/ >
Options ExecCGI FollowSymlinks
AllowOverride all
Allow from all
Order allow,deny
</Directory>
</VirtualHost>

For context, I also have in httpd.conf:

DocumentRoot "C:/www/webroot"

On my hard drive, the path to typo is:

C:\www\webroot\typo


If I serve it up through WEBrick, I get:

routes.rb should work just fine as is. I suspect that the
<VirtualHost *> directive you're using is a bit off. I'd get rid of
the ServerName typo to start.

Are you trying to serve it via Apache as a .cgi?

Can you serve typo via Webrick on port 3000 (the default Webrick
port)? i.e. start script/server and goto http://localhost:3000

Is your Rails up to date? how about your gems? I've found that I've
seen errors that didn't make sense because all the bits weren't up to
date.
 
G

gander

Thanks, Craig. After thinking about your response and a bit of trial
and error, I got Typo up and running.

I appreciate your time.

--George
 
C

Curt Hibbs

gander said:
Thanks, Craig. After thinking about your response and a bit of trial
and error, I got Typo up and running.

I appreciate your time.

Can you post what you did and/or your final configuration files? That
way it will be in the message archives to help the next person who has
the same problem.

Curt
 
P

pop.sbc.yahoo.com

Curt,
In that regard, can you recommend a browser that keeps track of threads or
is at least searchable?
jb
----- Original Message -----
From: "Curt Hibbs" <[email protected]>
To: "ruby-talk ML" <[email protected]>
Sent: Saturday, May 14, 2005 10:05 PM
Subject: Re: RoR on WinXP/Apache
 
G

gander

At Curt's (excellent) request, here's how I got Typo running on WinXP,
Apache, with Craig's guidance:

Http://localhost ruturned the "Congratulations, you've put Ruby on
Rails!" screen. Except, there was no index.html in my typo/public
directory, so that "Congrats" page was coming from somewhere else.

I had been messing around with the ToDo tutorials, so I suspected it
might be the "Congrats" page from ToDo. So I edited
ToDo/public/index.html and added some markup to identify this
particular "Congrats" page as living in the ToDo/public directory.

Back in the browser, I refreshed http://localhost and, lo, I saw the
ToDo "Congrats" page. At this point I saw it wasn't a Rails issue, but
an Apache issue.

In Apache's httpd.conf, I had this, left over from the ToDo tutorial:

<VirtualHost *>
ServerName todo
DocumentRoot /www/webroot/ToDo/public
<Directory /www/webroot/ToDo/public/ >
Options ExecCGI FollowSymlinks
AllowOverride all
Allow from all
Order allow,deny
</Directory>
</VirtualHost>

So I commented out that block.

Whenever you change httpd.conf, you must restart Apache so the new
config is loaded. So I restarted Apache.

Back in the browser; refresh http://localhost and I get

------------------------------------------
Application error (Apache)
500 Error

Change this error message for exceptions thrown outside of an action
(like in Dispatcher setups or broken Ruby code) in public/500.html
------------------------------------------

I knew the typo/public directory had a 500.html file in it, so I edited
that file and changed "500 Error" to "Typo: 500 Error." Save the
changes.

Refresh http://localhost and I get the 500 error again, but this time I
see "Typo: 500 Error" so I know Apache is serving the right directory.
Now I need to figure out what's causing the 500 error.

I thought really, really hard about it. And for a long time. But that
didn't work. Not at all. So it then dawned on me to read the log
files, which turned out to be much more productive than just thinking.

By luck, I started poking around in the typo/log directory looking for
the most recently modified file.

The file "fastcgi.crash.log" been very recently modified. That fit
with the scenario since 500 errors are "web server errors" which means
something, typically below the level of code you right for your web
site, crashed, choked or blew up. Fastcgi qualifies as something below
the level of my code and the name of the file ("fastcgi.crash.log")
validated the fact that something went amiss with the process.

Opening the log, the first line of the bottom block (the block relevant
to the date/time I was now working) showed:
-------------------------------------------
[Sat May 14 22:04:19 Eastern Daylight Time 2005] Dispatcher failed to
catch: #42000Unknown database 'typo_dev' (Mysql::Error)
-------------------------------------------

Unknown database 'typo_dev'? I was using 'ganderson_typo' for my
database, no wonder it crashed. So now the question: What in my code
said I was using 'typo_dev' as my database (and was ultimately
responsible for crashing fastcgi and producing the 500 error)?

I didn't know the answer to that question, but I knew that
typo/config/database.yaml held info on "my" databases. So I changed
"development," "test," and "production" to:

database: ganderson_typo

I restarted Apache and refreshed http://localhost.

BANG! It worked.

Later I found the settings for which database is used are in
typo/config/environment.rb. I believe when you make changes to this
file, you need to restart Apache because, and I may be completely
wrong, fastcgi causes some of these config options to be cached by
Apache. Changes to such files may not be reflected until the Apache
service is restarted.

One last thing I forgot to mention:

I have this in httpd.conf:

<VirtualHost *>
ServerName typo
DocumentRoot /www/webroot/typo/public
<Directory /www/webroot/typo/public/ >
Options ExecCGI FollowSymlinks
AllowOverride all
Allow from all
Order allow,deny
</Directory>
</VirtualHost>

and I had to remove this line:

ServerName typo

which left me with this:

<VirtualHost *>
DocumentRoot /www/webroot/typo/public
<Directory /www/webroot/typo/public/ >
Options ExecCGI FollowSymlinks
AllowOverride all
Allow from all
Order allow,deny
</Directory>
</VirtualHost>

Craig pointed this out in his original response.

Now everything is being served out of http://localhost.

Can anyone tell me how to serve typo out of http://localhost/typo? I
know it's a change in Apache's httpd.conf, I just don't know what to
change.

Thanks for your help.

--George
 
C

Curt Hibbs

Thank you for posting this excellent walk-through. I'm sure that this is
a question that will periodically recur on this list and now we need
only point questioners to this.

Curt
At Curt's (excellent) request, here's how I got Typo running on WinXP,
Apache, with Craig's guidance:

Http://localhost ruturned the "Congratulations, you've put Ruby on
Rails!" screen. Except, there was no index.html in my typo/public
directory, so that "Congrats" page was coming from somewhere else.

I had been messing around with the ToDo tutorials, so I suspected it
might be the "Congrats" page from ToDo. So I edited
ToDo/public/index.html and added some markup to identify this
particular "Congrats" page as living in the ToDo/public directory.

Back in the browser, I refreshed http://localhost and, lo, I saw the
ToDo "Congrats" page. At this point I saw it wasn't a Rails issue, but
an Apache issue.

In Apache's httpd.conf, I had this, left over from the ToDo tutorial:

<VirtualHost *>
ServerName todo
DocumentRoot /www/webroot/ToDo/public
<Directory /www/webroot/ToDo/public/ >
Options ExecCGI FollowSymlinks
AllowOverride all
Allow from all
Order allow,deny
</Directory>
</VirtualHost>

So I commented out that block.

Whenever you change httpd.conf, you must restart Apache so the new
config is loaded. So I restarted Apache.

Back in the browser; refresh http://localhost and I get

------------------------------------------
Application error (Apache)
500 Error

Change this error message for exceptions thrown outside of an action
(like in Dispatcher setups or broken Ruby code) in public/500.html
------------------------------------------

I knew the typo/public directory had a 500.html file in it, so I edited
that file and changed "500 Error" to "Typo: 500 Error." Save the
changes.

Refresh http://localhost and I get the 500 error again, but this time I
see "Typo: 500 Error" so I know Apache is serving the right directory.
Now I need to figure out what's causing the 500 error.

I thought really, really hard about it. And for a long time. But that
didn't work. Not at all. So it then dawned on me to read the log
files, which turned out to be much more productive than just thinking.

By luck, I started poking around in the typo/log directory looking for
the most recently modified file.

The file "fastcgi.crash.log" been very recently modified. That fit
with the scenario since 500 errors are "web server errors" which means
something, typically below the level of code you right for your web
site, crashed, choked or blew up. Fastcgi qualifies as something below
the level of my code and the name of the file ("fastcgi.crash.log")
validated the fact that something went amiss with the process.

Opening the log, the first line of the bottom block (the block relevant
to the date/time I was now working) showed:
-------------------------------------------
[Sat May 14 22:04:19 Eastern Daylight Time 2005] Dispatcher failed to
catch: #42000Unknown database 'typo_dev' (Mysql::Error)
-------------------------------------------

Unknown database 'typo_dev'? I was using 'ganderson_typo' for my
database, no wonder it crashed. So now the question: What in my code
said I was using 'typo_dev' as my database (and was ultimately
responsible for crashing fastcgi and producing the 500 error)?

I didn't know the answer to that question, but I knew that
typo/config/database.yaml held info on "my" databases. So I changed
"development," "test," and "production" to:

database: ganderson_typo

I restarted Apache and refreshed http://localhost.

BANG! It worked.

Later I found the settings for which database is used are in
typo/config/environment.rb. I believe when you make changes to this
file, you need to restart Apache because, and I may be completely
wrong, fastcgi causes some of these config options to be cached by
Apache. Changes to such files may not be reflected until the Apache
service is restarted.

One last thing I forgot to mention:

I have this in httpd.conf:

<VirtualHost *>
ServerName typo
DocumentRoot /www/webroot/typo/public
<Directory /www/webroot/typo/public/ >
Options ExecCGI FollowSymlinks
AllowOverride all
Allow from all
Order allow,deny
</Directory>
</VirtualHost>

and I had to remove this line:

ServerName typo

which left me with this:

<VirtualHost *>
DocumentRoot /www/webroot/typo/public
<Directory /www/webroot/typo/public/ >
Options ExecCGI FollowSymlinks
AllowOverride all
Allow from all
Order allow,deny
</Directory>
</VirtualHost>

Craig pointed this out in his original response.

Now everything is being served out of http://localhost.

Can anyone tell me how to serve typo out of http://localhost/typo? I
know it's a change in Apache's httpd.conf, I just don't know what to
change.

Thanks for your help.

--George
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,535
Members
45,007
Latest member
obedient dusk

Latest Threads

Top