From my prior doc
Rails Mongerl and Apache All togerher now 1 I created a very basic rails application, mostly for the purpose of displaying text, and maybe some images afterwards. I am going to run mongrel which I installed with
gem install mongrel
to see whether what I wrote displays through mongrel. I run
script/console
Which runs mongrel on port 3000. So I navigate to
http://jibwa.com:3000/photo
and I get XML back
Now I know my Rails is working properly and is rendering form the db. Now I need to get apache
to serve up the mongrel application. There are two ways to do this. For development I let apache start mongrel each time a user access the page. I just manually add virtual host entries to the httpd.conf
>vim /etc/httpd/conf/httpd.conf
Now I haven't installed any special mods to apache, its pretty much the default configuration I got from rackspace. I have a namevirtualhost entry
NameVirtualHost 128.196.77.111:80
Then a list of vhosts. To get my rails app to run I need to make a new vhost that points at the public directory.
Now I have all I need done to the httpd.conf file so I quit and save. Reload Apache with > /etc/init.d/httpd reload
Now I navigate to rails.jibwa.com/photo and I see my xml.
This works great for development. I set developers and myslef up in this way. Edits can be made to the dev installation and you never have to restart mongrel, it just reloads the whole rails app each time someone access the page.
The best way for production is to have rails running constantly in the background, and then use a proxypass to the port it is running under. This just requires that you run mongrel in deamon mode, and probably on a different port. Then setting the proxypass up in httpd.conf
When you install mongel it installs a nice little application which allows you to start mongrel in different modes. So I run
> mongrel_rails start -d -p 9876
Then I make sure I can navigate to the site on that port. I go to http://jibwa.com:9876 and I see my welcome to rails message and know that the daemon mode is running fine. If you want to stop it, just goto your rails application direcrtory and type
> mongrel_rails stop
So last we modify at the apache conf file and change the virtualhost from before to look like this.
Now I navigate to rails.jibwa.com and it loads much quicker. I hope this helps, and if anyone knows any other tricks and tips for this I would gladly like to hear them.
Be first to comment this article
Write Comment
Please keep the topic of messages relevant to the subject of the article.
Personal verbal attacks will be deleted.
Please don't use comments to plug your web site. Such material will be removed.
Just ensure to *Refresh* your browser for a new security code to be displayed prior to clicking on the 'Send' button.
Keep in mind that the above process only applies if you simply entered the wrong security code.
Jibwa.com is under construction. Watch out for broken links, missing pages, potholes and bulldozers. We apologize for the temporary inconvenience - Jibwa.com Staff
News and Updates
What to do when a website breaks
Once in a while you go to check out your personal website, or to log into your company web email and you can't. For the average person going about... Read More ...
Find how much ram and processor your computer has
Most people remember buying their computer, and usually there was a point where you had to decide based on price what processor you wanted, and how ... Read More ...
How to see home much storage/disk space you have left
Finding out how much space is left on your computer or how much space you have on your computer total is something very simple, but it can also ... Read More ...
Jibwa and The Future of Computing
The staff and consultants at Jibwa LLC have been tinkering, working with, building, and developing software on compters since long before there was t... Read More ...