View previous topic :: View next topic |
Author |
Message |
Napalm Llama Guru
![Guru Guru](/images/ranks/rank_rect_3.gif)
![](images/avatars/4075621174655b73b2934a.png)
Joined: 04 Jun 2005 Posts: 533 Location: Cardiff, UK
|
Posted: Tue Feb 20, 2007 3:27 am Post subject: Ruby & Apache - how's it done? [SOLVED] |
|
|
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 ![Confused :?](images/smiles/icon_confused.gif) _________________ 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 |
|
![](templates/gentoo/images/spacer.gif) |
krolden Apprentice
![Apprentice Apprentice](/images/ranks/rank_rect_2.gif)
![](images/avatars/203679882340b70ee067e0c.gif)
Joined: 28 May 2004 Posts: 293 Location: Belgium
|
Posted: Wed Feb 21, 2007 5:45 pm Post subject: |
|
|
check your file permissions on the ruby/ directory and the .rb file and make sure apache can access it. |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
Napalm Llama Guru
![Guru Guru](/images/ranks/rank_rect_3.gif)
![](images/avatars/4075621174655b73b2934a.png)
Joined: 04 Jun 2005 Posts: 533 Location: Cardiff, UK
|
Posted: Wed Feb 21, 2007 6:49 pm Post subject: |
|
|
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 |
|
![](templates/gentoo/images/spacer.gif) |
dleverton Guru
![Guru Guru](/images/ranks/rank_rect_3.gif)
Joined: 28 Aug 2006 Posts: 517
|
Posted: Wed Feb 21, 2007 7:57 pm Post subject: Re: Ruby & Apache - how's it done? |
|
|
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 |
|
![](templates/gentoo/images/spacer.gif) |
Napalm Llama Guru
![Guru Guru](/images/ranks/rank_rect_3.gif)
![](images/avatars/4075621174655b73b2934a.png)
Joined: 04 Jun 2005 Posts: 533 Location: Cardiff, UK
|
Posted: Wed Feb 21, 2007 8:27 pm Post subject: Re: Ruby & Apache - how's it done? |
|
|
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 ![Very Happy :D](images/smiles/icon_biggrin.gif) _________________ Ryzen 5600x; Asus TUF Gaming B550-Plus; Geforce 1660 Super
Registered Linux User #381314
# killall humans |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
|