Adding wordpress Blog in a Rails application - ruby-on-rails

I have Rails application deployed on my home root directory of a domain and symlinked with my public_html/applicationname.com/. I wanted to install wordpress in applicationname.com/blog path. But rails ain`t allowing me to do so. I have tried a subdomain as well, but still, the routes are being handled by Rails.
What would be the best solution to deploy a blog along with Rails application ?
I can only think of .htaccess modification.

You should put your blog into the rails' public directory.That's the place for static files (and php ones are).

If you are deploying your rails app using Passenger then you can disable Passenger for a particular location. See section 5.8 of the documentation, which has an example for WordPress.

This article may be useful to anyone looking to solve this problem:
http://www.spotscore.com/blog/2009/11/22/how-to-host-wordpress-and-phusion-passenger-rails-app-on-the-same-domain/

Check the post :
http://joomlist.com/2011/10/php-in-subdirectory-of-rubyonrails/. it worked using passenger with apache.

Related

Heroku App with a Wordpress Blog

I recently discovered that Heroku now allows PHP which means that a wordpress blog can be hosted on it. I also found this project template: https://github.com/mhoofman/wordpress-heroku
I have a ruby on rails app which is to be hosted on heroku with a domain www.mysite.com, and in that app, i need a way for www.mysite.com/blog to show the wordpress blog.
Can someone help me out, with details on how I can do this?
Whilst I've not used the new PHP platform I don't think what you're asking for is going to be possible.
When you deploy an application to Heroku it detects the type of application during the push process and sets up the application accordingly, Heroku use Apache to host PHP as you can see from the output in this post http://tjstein.com/2011/09/running-wordpress-on-heroku-and-amazon-rds/ - there's not been any mention of mixing platforms in a single application yet so would imagine that it's not supported.
The nearest you'd get is hosting your site and your blog in two seperate applications with the blog on blog.mysite.com and then put a redirect on www.mysite.com/blog to the blog.mysite.com url.
Im Still working on this
the closest to getting a solution is using the reverse proxy gem
see the answer here:
How can I use a subdirectory instead of a subdomain?

Add blog to Rails app on Heroku

I have a Rails app on Heroku with a Jekyll blog located at blog.myapp.com. I want to move the blog to www.myapp.com/blog/. What's the best way to do this? I'm happy to ditch Jekyll if there is an easier option. Thanks!
Bloggy seems to be what you're looking for.
"Bloggy is a simple gem that helps you generate a jekyll blog within your rails application by using generator commands similar to the ones you are used to already."
You should be able to change the base-url configuration to /blog for this to work.
https://github.com/mojombo/jekyll/wiki/Configuration

I'm a bit lost: how to render rails/ruby on a website?

Ok, long time php guy doing my best to pick up ruby on rails by developing a small website for myself using only ror instead of php.
However i'm a bit stuck, and i think it is because i'm not exactly understanding how rails actually works.
I am running centos 5.5 / apache2. I have successfully installed ruby, rubygems, and subsequently rails and passenger. All these are 'working', i can run ruby commands, gem commands etc.
But how do I start using rails on my website? If I create an .erb or .rb file with some simple ruby commands, it just displays as plain text when I navigate to it.
Do I need to configure apache to 'execute' .rb or .erb files (similar to the way .php files execute?).
Any help would be GREATLY appreciated!!
You might check out the Rails Getting Started Guide: http://guides.rubyonrails.org/getting_started.html
I suggest you read a huge tutorial on this topic: http://guides.rubyonrails.org/getting_started.html.
Ruby is the language, and Ruby on Rails is a framework. From the guide:
Rails is a web application development
framework written in the Ruby
language. It is designed to make
programming web applications easier by
making assumptions about what every
developer needs to get started. It
allows you to write less code while
accomplishing more than many other
languages and frameworks. Experienced
Rails developers also report that it
makes web application development more
fun.
I'd read Chapter 4, if you already know all this, as it talks about the actual webserver.
Rails comes with it's own webserver, so Apache isn't needed.
Sounds like you need to really get a handle on Rails and what it is first. This site has some great information for beginners, and should help you understand what you are working with and your next steps to get an application running:
http://guides.rubyonrails.org/getting_started.html
I've also heard some good things about the information here:
http://railsforzombies.org/
Check out Ruby on Rails Tutorial for getting started in Rails.
As #Blender mentioned, rails comes with an in build web server called webrick. (Think of it same as apache .. for now)
so all you have to do is go to the rails project directory, and run the command
if you are using rails < 3.x
ruby script/server
if you are using rails > 3.x
rails server
once u done this your rails project will start in webrick server and by default in port 3000
http://localhost:3000
you may consider apache/ some other rails server setup for production deployment, but to get started you dont need apache at all
and welcome to ruby world ! :D
HTH
sameera

Deploying a RoR application in a separate folder

Let me start by saying I have never deployed a Rails app before.
I have a domain with a main site ran by PHP, let's call it http://www.example.com/.
I have began developing for Rails recently, and I'd like to host the new application I created on http://www.example.com/myapp while still keeping the original site intact.
The main site is hosted on Godaddy.com, but in my understanding they do not support rails well (my application is written in Rails 2.3.5). With that being said, I decided to host my rails app on Dreamhost.com.
So I have two questions: how do I deploy a rails app in a 'folder' on the main domain that actually links to dreamhost. Second, where do I get started with deploying the app?
Thank you!
Personally, I would setup a subdomain on dreamhost: http://myapp.example.com/
Then if you want people to be able to access it via http://www.example.com/myapp, put an .htaccess redirect on your godaddy site:
redirect 301 /myapp/ http://myapp.example.com/
Information on deploying Ruby on Rails on dreamhost's wiki:
http://wiki.dreamhost.com/index.php/Ruby_on_Rails

How to deploy a Rails app to Dreamhost?

I'm kind of lost, I try to deploy my application on a shared dreamhost server.
Now everything works fine locally. It's my first try at Rails, and I'm not really a programmer or sysadmin, just hacking something together.
On Dreamhost, if I start webrick, it works fine on port 3000, but webricks gets killed pretty quickly, I guess that makes sense.
So what do I have to do to make it run?
I enabled fastcgi support and mod_rails.
Now, how do I get the app constantly running?
I keep reading about having to do things to .htaccess and to dispatch.fcgi.
But I can't find any dispatch file in my rails app (2.3.2).
Do I have to create that one manually? Doesn't really feeld very rails-like to me. I didn't really manage to find out what this dispatch file does, and why it's needed.
Any help would be greatly appreciated.
I looked at the DH Wiki, but couldn't figure it out (http://wiki.dreamhost.com/Rails)
Additions:
I enabled mod_rails and pointed to the public directory (I had already done that).
I keep getting an error: screencast.com/t/KamqVawk
Hm, server logs look like there is actually no request, so this might be a problem on dreamhosts end. It's strange I see that the access.log show a new change date, when I try to access the page, but there is no request noted, error.log is empty too.
Dreamhost Support Answer:
The server was up to date, so that wasn't the problem.
They proposed freezing the Gems, which I did (see: http://wiki.dreamhost.com/Freezing_Gems)
But it didn't help.
I guess I'm giving up, and looking into hosting which is specialized for rails.
Thx for all your help!
Changed to hostingrails.com
I got the app working on hostingrails.com, passenger on hostingrails.com showed me errors, which weren't shown by dreamhost or mongrel. By correcting these errors, I got the app working.
Dreamhost won't let you use webrick if you're using shared hosting. You can either use FastCGI or Passenger to host Rails on shared DH (mongrel is an option if you upgrade to DreamhostPS, but that's obviously more expensive).
For FastCGI, you will need a dispatch.fcgi file (older versions of Rails would generate one when you created a new Rails app, but that stopped around 2.2 if I remember correctly) as well as code in your .htaccess to send requests to the dispatcher. See the Dreamhost Ruby on Rails wiki page for details about setting up FastCGI.
The more preferable option is to set up your application to run on Phusion Passenger (aka mod_rails). It should be pretty simple through your Dreamhost panel, you just need to enable the domain to use mod_rails, and then set the directory for the domain to the public directory of your application. See the Passenger wiki page for more details.

Resources