I installed Passenger on my Ubuntu box with a custom-built Apache
2.2.6, and all of the Rails side of the app works great, but static
files are not being loaded. I get a standard 403 Forbidden error
served by Apache, and in my error_log file, all I get is
client denied by server configuration: /myxyzappfolder/public/
javascripts/effects.js
etc. My app appears to have been spawned by my regular user account on
the box and all my app files are owned by me, not to mention they're
at least readable by everyone. I had renamed .htaccess to
htaccess.dumb just in case mod_rewrite was messing something up, but
that didn't help.
Any ideas or tips on how to troubleshoot further? It seems like this
should be a no-brainer, but I can't figure it out.
> I installed Passenger on my Ubuntu box with a custom-built Apache
> 2.2.6, and all of the Rails side of the app works great, but static
> files are not being loaded. I get a standard 403 Forbidden error
> served by Apache, and in my error_log file, all I get is
> client denied by server configuration: /myxyzappfolder/public/
> javascripts/effects.js
> etc. My app appears to have been spawned by my regular user account on
> the box and all my app files are owned by me, not to mention they're
> at least readable by everyone. I had renamed .htaccess to
> htaccess.dumb just in case mod_rewrite was messing something up, but
> that didn't help.
> Any ideas or tips on how to troubleshoot further? It seems like this
> should be a no-brainer, but I can't figure it out.
> I installed Passenger on my Ubuntu box with a custom-built Apache
> 2.2.6, and all of the Rails side of the app works great, but static
> files are not being loaded. I get a standard 403 Forbidden error
> served by Apache, and in my error_log file, all I get is
> client denied by server configuration: /myxyzappfolder/public/
> javascripts/effects.js
> etc. My app appears to have been spawned by my regular user account on
> the box and all my app files are owned by me, not to mention they're
> at least readable by everyone. I had renamed .htaccess to
> htaccess.dumb just in case mod_rewrite was messing something up, but
> that didn't help.
> Any ideas or tips on how to troubleshoot further? It seems like this
> should be a no-brainer, but I can't figure it out.
I had the same issue, try something like this:
<VirtualHost *:80>
ServerName selleo.com
ServerAlias www.selleo.com DocumentRoot /var/www/selleo.com/public
<Directory "/var/www/selleo.com/public">
Options FollowSymLinks
AllowOverride None
Order allow,deny
Allow from all
</Directory>
RailsBaseURI /
</VirtualHost>
Ah, that makes sense. Thanks Tomasz, it works great now. I think the
docs should make note of this, considering that not everyone is going
to realize that they need to have a standard working setup in the
Apache config for accessing their static files BEFORE they even think
about putting in the Rails component. I thought that would happen
automatically.
Thanks again,
Jared
On Apr 12, 6:06 am, "helloli...@gmail.com" <helloli...@gmail.com>
wrote:
> and i don't have problem, just the app above don't work.
> PS: sorry for my bad english, i'm from brazil and i'm learning :)
> On 13 abr, 07:23, Hongli Lai <hon...@phusion.nl> wrote: > > ChrisR wrote: > > > Thanks Tomasz, it might have taken me a while to figure out this > > > obvious solution.
> > > I agree with you Jared, the docs should make note of it.
> > > Thanks > > > Chris
> > Thanks for the feedback. I've updated the users guide accordingly.
> > -- > > Phusion | The Computer Science Company
> > Web:http://www.phusion.nl/ > > E-mail: i...@phusion.nl > > Chamber of commerce no: 08173483 (The Netherlands)
I've followed all the guidance on this, but I still can't see the
images in my Rails application.
My virtual host looks like this:
<VirtualHost *>
ServerAdmin john@kirtley
DocumentRoot /home/usr/HomePage/Current/
<Directory "/home/usr/HomePage/Current/">
Options FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
Allow from all
</Directory>
<Directory "/home/usr/jallen/ruby/Depot2/public">
Options FollowSymLinks
Order allow,deny
Allow from all
</Directory>
RailsBaseURI /app1
RailsEnv development
</VirtualHost>
The Depot2 application (this is the sample application from the book
"Agile Web Development with Rails") lives at /home/usr/jallen/ruby/
Depot2
This folder and everything inside it has permissions 777 and belongs
to a general-purpose user "pcguest".
The DocumentRoot is "/home/usr/HomePage/Current" and within this
folder there is a symbolic link "app1" which points to /home/usr/
jallen/ruby/Depot2/public.
In the Apache error log, I'm seeing messages like:
[Sat May 03 12:17:18 2008] [error] [client 192.168.0.1] File does not
exist: /home/usr/HomePage/Current/images, referer: http://allenlux.dyndns.org/app1
which seems to indicate that the Rails application is looking for the
images in "/home/usr/HomePage/Current/images" which of course doesn't
exist. It should be looking in "/home/usr/jallen/ruby/Depot2/public/
images".
Everything else in the Depot2 application works fine.
Is this a bug in the application, or a problem with my Apache
configuration?
allenlux wrote: > which seems to indicate that the Rails application is looking for the > images in "/home/usr/HomePage/Current/images" which of course doesn't > exist. It should be looking in "/home/usr/jallen/ruby/Depot2/public/ > images".
Maybe your HTML is referencing /images/foo.png instead of /app1/images/foo.png?
-- Phusion | The Computer Science Company
Web: http://www.phusion.nl/ E-mail: i...@phusion.nl Chamber of commerce no: 08173483 (The Netherlands)
On May 8, 9:51 am, Hongli Lai <hon...@phusion.nl> wrote:
> allenlux wrote:
> > which seems to indicate that the Rails application is looking for the
> > images in "/home/usr/HomePage/Current/images" which of course doesn't
> > exist. It should be looking in "/home/usr/jallen/ruby/Depot2/public/
> > images".
> Maybe your HTML is referencing /images/foo.png instead of
> /app1/images/foo.png?
Thanks, you are right. I changed the paths in the Depot2 application
and now the images are visible.
But now I have 2 more questions:
1. The Depot2 application worked fine with the original image
references when running under webrick or mongrel. It seems curious
that running under Passenger requires that all the image references
have to be changed.
2. The path "/app1/images/foo.png" seems counter-intuitive to me. The
application folder is Depot2, so why isn't the path "/Depot2/images/
foo.png"? I thought that "app1" was just a way for Passenger to find
its way from the Apache virtual host to the real folder for the Rails
application.
allenlux wrote: > 1. The Depot2 application worked fine with the original image > references when running under webrick or mongrel. It seems curious > that running under Passenger requires that all the image references > have to be changed.
Back when it was running in Mongrel, was Depot2 deployed to a subdirectory?
Passenger doesn't, and can't, fix the HTML output for you - you have to do that yourself.
> 2. The path "/app1/images/foo.png" seems counter-intuitive to me. The > application folder is Depot2, so why isn't the path "/Depot2/images/ > foo.png"? I thought that "app1" was just a way for Passenger to find > its way from the Apache virtual host to the real folder for the Rails > application.
Because "app1" is part of the URI while "Depot2" is part of the filename. Since this is HTTP, you're supposed to reference everything by URI. The actual on-disk filename has got nothing to do with it. -- Phusion | The Computer Science Company
Web: http://www.phusion.nl/ E-mail: i...@phusion.nl Chamber of commerce no: 08173483 (The Netherlands)
On May 9, 4:00 pm, Hongli Lai <hon...@phusion.nl> wrote:
> allenlux wrote:
> > 1. The Depot2 application worked fine with the original image
> > references when running under webrick or mongrel. It seems curious
> > that running under Passenger requires that all the image references
> > have to be changed.
> Back when it was running in Mongrel, was Depot2 deployed to a subdirectory?
I just copied the demo application into the directory:
//kirtley/home/usr/jallen/ruby/Depot2
Underneath this directory are all the usual Rails folders: app/,
components/, public/, script etc.
With Depot2 as my current working directory, I can start the
application under Mongrel with the command script/server.
This still works, although after changing the image paths for
Passenger the images can't be found by the instance of Depot2 running
under Mongrel.
> Passenger doesn't, and can't, fix the HTML output for you - you have to
> do that yourself.
> > 2. The path "/app1/images/foo.png" seems counter-intuitive to me. The
> > application folder is Depot2, so why isn't the path "/Depot2/images/
> > foo.png"? I thought that "app1" was just a way for Passenger to find
> > its way from the Apache virtual host to the real folder for the Rails
> > application.
> Because "app1" is part of the URI while "Depot2" is part of the
> filename. Since this is HTTP, you're supposed to reference everything by
> URI. The actual on-disk filename has got nothing to do with it.
In theory, yes, but I still find it puzzling that 2 different servers
for Rails apparently handle these URIs differently.
allenlux wrote: > In theory, yes, but I still find it puzzling that 2 different servers > for Rails apparently handle these URIs differently.
I don't understand what you're expecting. It's your *HTML* that's referencing the wrong URIs. Passenger or the web server have got nothing to do with it. -- Phusion | The Computer Science Company
Web: http://www.phusion.nl/ E-mail: i...@phusion.nl Chamber of commerce no: 08173483 (The Netherlands)
On May 9, 8:54 pm, Hongli Lai <hon...@phusion.nl> wrote:
> allenlux wrote:
> > In theory, yes, but I still find it puzzling that 2 different servers
> > for Rails apparently handle these URIs differently.
> I don't understand what you're expecting. It's your *HTML* that's
> referencing the wrong URIs. Passenger or the web server have got nothing
> to do with it.
I did a little more research which I should have done before, of
course.