Rails + apache question


#1

Hi all,

I’ve read the symlinks wiki and some other wiki pages relating to Apache
but I’m just not “getting it”.

Mandrake Linux (kernel 2.6.8)
Apache 1.3.3

DocumentRoot is “/home/httpd/html”
Application is physically located in
“/home/httpd/applications/foo-1.0.0”
I would like the URL to be “http://host.domain.com/foo

I’ve created a “/home/httpd/html/foo” directory.
I’ve created a link using “ln -s
/home/httpd/applications/foo-1.0.0/public /home/httpd/html/foo”
I added “RewriteBase /foo” to the .htaccess file in
/home/httpd/applications/foo-1.0.0/public

However, when I try to visit http://host.domain.com/foo I get a “cannot
find server” error. The apache error log shows this:

File does not exist: /home/httpd/html/foo:3000

What am I doing wrong? And how do I get it to just use port 80? I’d
rather not create a separate Apache process, btw, if possible.

Regards,

Dan


#2

Try making the sym link “ln -s
/home/httpd/applications/foo-1.0.0 /home/httpd/html/foo”
and change the document root in apache to /home/httpd/html/foo/public
rails is probably having a hard time finding itself because it cannot
use …/environment since the environment directory is not in
/home/httpd/html
Let me know if this helps
David


#3

Not that my post answers your question, but it may be useful:

I have a mass hosting setup using mod_rewrite and the following lines
of code did the magic for me in routing requests to dispatch.fcgi (I
edited some rules for images and javascripts to keep it short):

I placed them in a .conf for apache.

AddHandler fastcgi-script .fcgi
AddHandler cgi-script .cgi

RewriteCond ${lowercase:%{SERVER_NAME}} domain.com$
RewriteRule ^/(.*)$ /path/to/domain.com/docs/public/dispatch.fcgi
[QSA,L]

Just thought it may be helpful.
Thanks
Frank

“Berger, Daniel” removed_email_address@domain.invalid wrote: Hi all,

I’ve read the symlinks wiki and some other wiki pages relating to Apache
but I’m just not “getting it”.

Mandrake Linux (kernel 2.6.8)
Apache 1.3.3

DocumentRoot is “/home/httpd/html”
Application is physically located in
“/home/httpd/applications/foo-1.0.0”
I would like the URL to be “http://host.domain.com/foo

I’ve created a “/home/httpd/html/foo” directory.
I’ve created a link using “ln -s
/home/httpd/applications/foo-1.0.0/public /home/httpd/html/foo”
I added “RewriteBase /foo” to the .htaccess file in
/home/httpd/applications/foo-1.0.0/public

However, when I try to visit http://host.domain.com/foo I get a “cannot
find server” error. The apache error log shows this:

File does not exist: /home/httpd/html/foo:3000

What am I doing wrong? And how do I get it to just use port 80? I’d
rather not create a separate Apache process, btw, if possible.

Regards,

Dan


#4

I need to correct what I just said because that won’t work but if you
look in the .htaccess file in the public directory you will have your
answer.
Here is what you need in the apache config file:
Alias /foo /home/httpd/applications/foo-1.0.0/public

Then add the following line in the .htaccess file:
RewriteBase /foo

That should do you.
David