RoR and Apache2 and app in local directory


#1

Hi all. I’m at my wits end… I’m trying to set up a Rails app (on a
Ubuntu system), within the public_html directory in my home directory
(as opposed to the /var/www/ directory). ie. in
/users/john/public_html/myapp

I have a simple app setup, and using the Webrick server it works fine.

But trying to get Apache to work is becoming a pain in the &^.

I followed the directions on this page:

http://wiki.rubyonrails.com/rails/pages/HowToUseRailsWithRewrittenURLs

But when I try going to the URL of a controller I get:

“You don’t have permission to access /~john/myapp/public/dispatch.cgi on
this server”

I’m guessing it has to do with not having CGI access in the directory,
but I don’t know how to get it set up. I haven’t touched the default
apache2.conf file (I’m not sure what to add), and adding the line:

Options +FollowSymLinks +ExecCGI

to the .htaccess file gives an error (‘Options’ is not allowed in the
.htaccess file)

Does anyone have any hints or tips on what I need to change? I’m sure
it’s something in the apache2.conf file (or maybe a file in the
/etc/apache2/sites-available/ directory?)

Thanks a bunch - this seems like a whole lot of hassle to go through
just to get a simple site up and running!

– John


#2

I may be offf base here, but is the owner/group www-data for your
directories / files?

Michael T.


#3

Am Dienstag, den 03.01.2006, 08:04 +0100 schrieb John T.:

just to get a simple site up and running!

– John

If that is not your server you should tell your administrator to let you
execute CGI scripts. This can be done to set the above Options directive
in the vhost configuration. If your server runs Debian this is in
fact /etc/apache2/sites-available/[your_vhost_file].

If your Administrator is a nice guy he could set the AllowOverride
Options directive in your vhost configuration, so that your .htaccess
Options directive will work.

There is no proof that this will solve your problem, but may help you to
get on the right way.


#4

Norman T. wrote:

If that is not your server you should tell your administrator to let you
execute CGI scripts. This can be done to set the above Options directive
in the vhost configuration. If your server runs Debian this is in
fact /etc/apache2/sites-available/[your_vhost_file].

If your Administrator is a nice guy he could set the AllowOverride
Options directive in your vhost configuration, so that your .htaccess
Options directive will work.

There is no proof that this will solve your problem, but may help you to
get on the right way.

Ah ha… it was my own error. It is my own server, so I can make
whatever changes I need. I did have a configuration file in
/etc/apache2/sites-available … but I had forgotten to create the
corresponding file in /etc/apache2/sites-enabled. Once I did that, I was
able to use the Option ExecCGI in my .htaccess.

Thanks!