Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Ruby & Apache - how's it done? [SOLVED]
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Networking & Security
View previous topic :: View next topic  
Author Message
Napalm Llama
Guru
Guru


Joined: 04 Jun 2005
Posts: 533
Location: Cardiff, UK

PostPosted: Tue Feb 20, 2007 3:27 am    Post subject: Ruby & Apache - how's it done? [SOLVED] Reply with quote

Hi there. I've just been Googling and forum searching for a decent tutorial on how to make my shiny new first-ever Ruby app play nice with Apache, but to no avail.

What I have is two .rb files (one's a library and gets included into the other) which work perfectly when run from the shell. They output things via puts. I've followed various tutorials to install mod_ruby as well as I can, and I have my two .rb files in /srv/www/htdocs/ruby (where /srv/www/htdocs is my DocumentRoot). My problem is that when I try to access them in a web browser. Instead of getting what I want (the same as appears on the shell), I get a message saying "Forbidden: You don't have permission to access /ruby/ical.rb on this server."

How do I make this message go away? I'm confused :?
_________________
Ryzen 5600x; Asus TUF Gaming B550-Plus; Geforce 1660 Super
Registered Linux User #381314
# killall humans


Last edited by Napalm Llama on Wed Feb 21, 2007 8:27 pm; edited 1 time in total
Back to top
View user's profile Send private message
krolden
Apprentice
Apprentice


Joined: 28 May 2004
Posts: 293
Location: Belgium

PostPosted: Wed Feb 21, 2007 5:45 pm    Post subject: Reply with quote

check your file permissions on the ruby/ directory and the .rb file and make sure apache can access it.
Back to top
View user's profile Send private message
Napalm Llama
Guru
Guru


Joined: 04 Jun 2005
Posts: 533
Location: Cardiff, UK

PostPosted: Wed Feb 21, 2007 6:49 pm    Post subject: Reply with quote

Looks fine to me:
Code:
splig ~ # ls -l /srv/www/htdocs/
  <snip>
drwxrwxr-x  2 apache apache     136 Feb 20 03:12 ruby
  <snip>

splig ~ # ls -l /srv/www/htdocs/ruby
total 40
-rw-rw-r-- 1 apache apache 26910 Feb 20 02:47 calendar.ics
-rw-rw-r-- 1 apache apache  4930 Feb 20 02:58 ical.rb
-rw-rw-r-- 1 apache apache   152 Feb 20 02:55 nextev.rhtml
splig ~ # ls -l /srv/www/htdocs/*.rb
-rwxr-xr-x 1 nl users 5113 Feb 20 18:52 /srv/www/htdocs/ical.rb
-rwxr-xr-x 1 nl users  149 Feb 20 12:46 /srv/www/htdocs/xnextev.rb


Do the ruby files need to be executable/have a particular file extension/be in a particular place? Do they need "#!/usr/bin/env ruby" at the start if they're acting as server-side scripts? Do they need PHP-like codes such as "<% %>" instead?

It's all very confusing and ambiguous...
_________________
Ryzen 5600x; Asus TUF Gaming B550-Plus; Geforce 1660 Super
Registered Linux User #381314
# killall humans
Back to top
View user's profile Send private message
dleverton
Guru
Guru


Joined: 28 Aug 2006
Posts: 517

PostPosted: Wed Feb 21, 2007 7:57 pm    Post subject: Re: Ruby & Apache - how's it done? Reply with quote

Napalm Llama wrote:
I get a message saying "Forbidden: You don't have permission to access /ruby/ical.rb on this server."

/var/log/apache2/error_log is your friend.
Back to top
View user's profile Send private message
Napalm Llama
Guru
Guru


Joined: 04 Jun 2005
Posts: 533
Location: Cardiff, UK

PostPosted: Wed Feb 21, 2007 8:27 pm    Post subject: Re: Ruby & Apache - how's it done? Reply with quote

dleverton wrote:
/var/log/apache2/error_log is your friend.

Fantastic! Turns out it was a combination of events (permissions, file locations) that was causing problems. But with the handy info from Apache's error log I was able to fix everything!

Thanks a lot :D
_________________
Ryzen 5600x; Asus TUF Gaming B550-Plus; Geforce 1660 Super
Registered Linux User #381314
# killall humans
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Networking & Security All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum