Rails, Phusion Passenger, Apache httpd Permission Denied error - Resolved one way.

Posted by Rajesh Shetty on February 25, 2009

This blog post is long due. Once again its a quick tip which can save lot of developers time in setting up rails with phusion passenger when they run into permission denied error.

After installing Passenger Phusion on a existing Apache HTTP web server when I started the Apache server and try to launch the app in browser I was getting following error.

[client ::1] (13)Permission denied: access to /favicon.ico denied, referer: http://localhost/

[client ::1] (13)Permission denied: access to / denied


After fixing obvious issues around permission like below, still no luck.
  • chmod on rails directory , so that Apache/Phusion would have all the permission to access the rails directory
  • Adjusting VirtualHost directory permission in Apache config (httpd.conf) file to allow all which would look something like this

<VirtualHost *:80>
ServerName localhost
DocumentRoot  <rails app directory>
<Directory  <rails app directory> >
Allow from all
</Directory>
RailsEnv development
RailsDefaultUser root
</VirtualHost>

As I was going thru httpd.conf in detail, I noticed that Apache kicking off the process under user  ”Daemon” every time I started the web server. This surely sounded like a issue to me and can lead to permission problems. So it was just a matter of changing this user to the my default user and bounce the server. This finally fixed it.
Look for following in your httpd.conf

User daemon


change this to

User <default machine user>


Here is one reference which talks about solution similar to what I explained above.

Following are some references for installing phusion passenger

Blogged with MessageDance using Gmail | Reply On Twitter

End of the working week RoR news + links

Posted by Rajesh Shetty on June 06, 2008

 Last 7 tweets from @rornews

 
http://feeds.feedburner.com/~r/RubyInside/~3/306418999/pool-party-poolparty-ruby… PoolParty: One Ruby Gem = Easy EC2 Computing Cloud at 06/06/2008 11:20 PM

 
http://feeds.feedburner.com/~r/RubyInside/~3/306366813/microsoft-arax-ruby-ajax-… Microsoft’s Latest Bad Idea? ARAX - Ruby-powered AJAX at 06/06/2008 09:20 PM

 
http://feeds.feedburner.com/~r/RubyInside/~3/300901062/pragmatic-screencasts-904… Active Record Screencasts: The Pragmatic Programmers Get Into Screencasting at 05/30/2008 04:40 AM

 
http://antoniocangiano.com/2008/05/29/this-week-in-ruby-may-29-2008/ This Week in Ruby (May 29, 2008) at 05/30/2008 02:00 AM

 
http://www.rubyinside.com/pragmatic-screencasts-904.html Active Record Screencasts: The Pragmatic Programmers Get Into Screencasting at 05/30/2008 01:20 AM

 
http://blog.caronsoftware.com/2008/5/29/twitter-api-user-ids Twitter API: User IDs at 05/29/2008 06:20 PM

 
http://rubyforge.org/forum/forum.php?forum_id=24785 custom db migrator (rails):Announcing Custom Migrator 0.1 release at 05/29/2008 01:40 AM

Blogged with MessageDance | Reply On Twitter

Live coverage of #railsconf by @igrigorik

Posted by Rajesh Shetty on May 30, 2008

Last 6 tweets from igrigorik

IronRuby on rails: only the sql driver was needed to get the stack running… Otherwise everything is the same, and works as expected at 05/30/2008 05:58 PM

Multicore FUD talk: first impression, stop reading from your notes… Room drifting asleep. #railsconf at 05/30/2008 05:50 PM

Back to pen and paper @ railsconf. Wewt. at 05/30/2008 05:45 PM

@timbray more twitter coverage of #railsconf here.. Courtesy of dead laptop. at 05/30/2008 06:31 PM

Multicore talk: plugged Switchpipe by @peterc - mix and match cluster management at 05/30/2008 06:29 PM

Engineyard: ebb is not production ready; don’t worry about the app server, should be the least of your worries. at 05/30/2008 07:15 PM

Blogged with MessageDance | Reply On Twitter

Interesting stuff happening around RoR world.

Posted by Rajesh Shetty on May 30, 2008

Last 5 tweets from rornews

http://tinyurl.com/468lgy custom db migrator (rails):Announcing Custom Migrator 0.1 release at 05/29/2008 01:40 AM

http://tinyurl.com/67ny5q Twitter API: User IDs at 05/29/2008 06:20 PM

http://tinyurl.com/6f6vrf This Week in Ruby (May 29, 2008) at 05/30/2008 02:00 AM

http://tinyurl.com/5dbdtt Active Record Screencasts: The Pragmatic Programmers Get Into Screencasting at 05/30/2008 01:20 AM

http://tinyurl.com/6qkdpa Active Record Screencasts: The Pragmatic Programmers Get Into Screencasting at 05/30/2008 04:40 AM

Blogged with MessageDance | Reply On Twitter

How to extract text from HTML using Ruby/Hpricot

Posted by Rajesh Shetty on April 25, 2008

I found this while solving my own problem. ( That is always a best way to learn). 


Requirement: Extract text from HTML body which includes ignoring large white spaces between tags and words.

Solution : Use Hpricot to do the magic

Assumption : Only HTML body is used here 

One liner : Hpricot(html).inner_text.gsub("\r"," ").gsub("\n"," ").split(" ").join(" ")
 

  1. Above line gets the inner text (which is a very convenient method to get the actual meat out of HTML)
  2. Replaces line returns into spaces. 
  3. Do a split/join which eliminates multiple spaces between tags and words. This trims it down to single space

Now if want scan thru the whole HTML right from <html> tags, then you will have to strip out script, link, meta, style tags as well. to do that just do following

hpricot = Hpricot(html)
hpricot.search("script").remove
hpricot.search("link").remove
hpricot.search("meta").remove
hpricot.search("style").remove



Blogged with MessageDance using Gmail

13 Seed Funding Options For Entrepreneurs - From @rww

Posted by Rajesh Shetty on April 16, 2008

By  Bernard Lunn

http://www.readwriteweb.com/archives/13_seed_funding_options_for_entrepreneurs.php

Some funny, Some serious. 

Blogged with MessageDance using Gmail

Passenger - mod_rails - Can this be a speed demon for Rails apps ?

Posted by Rajesh Shetty on April 15, 2008

What is Passenger ? (from http://www.modrails.com/)


 

Phusion Passenger — a.k.a. mod_rails — makes deployment of applications built on the revolutionary Ruby on Rails web framework a breeze. It follows the usual Ruby on Rails conventions, such as “Don’t-Repeat-Yourself”.


If this really picks up, expect to toss couple of key problems with rails based apps


 

  • Rails can potentially be as fast as PHP or Python : Everyone’s complain about Rails being slow (I agree up to some extent) , just because rails needs to go thru additional application server layer . Passenger should come bundled with mod_rails (as any other apache modules) and Apache itself (which may not be needed by too many people). So all you looking at Webserver -> mod_rails -> Rails execution framework, as lean as anything you can imagine
  • Deployment will be breeze as above site says.


Also comments from two of the best authorities on Ruby & Rails


- Matz (Yukihiro Matsumoto) said “It is often said that Rails is weak on deployment; PHP runs fairly fast just by uploading scripts.Rails is slow on development mode, and requires restarting on production mode (and bit complex to configure). modrails might be the answer for it.”.


- David Heinemeier Hansson says “This could become popular very fast”


Surely worth a try and this could answer and resolve tons of frustration rails programmers have as far as performance is concerned.


 




 

Blogged with MessageDance using Gmail

101 Year Old Man Running Marathon and Drinking.

Posted by Rajesh Shetty on April 13, 2008

Thats unreal, at this age he can SMOKE, DRINK and RUN ?. WoW!.

Blogged with MessageDance using YouTube

GitHub - Social Network for Nerds 1

Posted by Rajesh Shetty on April 11, 2008

http://github.com/

Look at this page http://github.com/news and it will give you what it really means. Kinda like facebook's public feed for programmers commit/going crazy activities. I like that.

Blogged with MessageDance using Gmail

Wired talking about “instapreneurs”

Posted by Rajesh Shetty on March 27, 2008

Quick read article on wired.com about the new age internet trend of "get it fast out there" .

One example mentioned in the article was Zazzle, how they get Disney's brand out there in public so fast, that traditional retailer can not even think about unless traditional folks spin their chain to have good online presence. Some of the interesting numbers in the article Ian mount talks about

Disney has uploaded more than 3,500 of its designs to Zazzle, allowing the company to sell a wider range of products than just the blockbuster Mickey Mouse T-shirts favored by conventional retailers. The service also gives the Disney machine unprecedented agility. "Here, I can see that Hannah Montana is taking off, we can upload a design right into Zazzle's system, and in a day or two it's a product," says Patrick Haley, senior manager of customization for DisneyShopping.com.

On the side note, now I see the term "instapreneur" catching up and will be another one to toss around in your discussion with friends about modern trends and buzzwords.

 

Blogged with MessageDance using Gmail