Hosting Ruby on Rails 000webhost - ruby-on-rails

I am trying to host my website onto 000webhost with my rails app. In Filezilla(ftp client) I added the folder where my rails app is but it says it needs to have an index file in order to display. I have an index file inside my welcome controller folder, but how do I get my host website to access this. Anyone with experience on doing this and pointing me in the right direction would help a lot.

From what I can see, the host does not support Ruby, only PHP. To run your code Rails project find a host that has Ruby language support. Example: Heroku.

Related

Deploy rails site from local to justhost server

I am new to rails and this question might be very basic. I learnt ruby on rails to create a small site which i have tested on herokuapp as well.
Now, I want to deploy it in the actual site which is hosted on justhost.
How should the application be deployed? Is there any way we could move the herokuapp directly to the server?
Thanks in advance.
Have you tried checking their help section? This tutorial from their website should show you everything you need: https://my.justhost.com/cgi/help/upload-site

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?

Solution found: cPanel-created Ruby On Rails setup returns blank pages for any views

Solution found!
This appears to be a bug specific to Mongrel + Rails 2.3.8, the webserver used by Rails+cPanel. This is why it only shows up when you run the app from cPanel, but not when serving it locally via script/server.
For more details, see:
https://rails.lighthouseapp.com/projects/8994/tickets/4690-mongrel-doesnt-work-with-rails-238
The eventual workaround found is to put the following file in the /config/initializers directory of each new Rails 2.3.8 app:
https://gist.github.com/471663
Once I add this initializer, my Rails app functions as expected.
Original question:
I've gone through the very helpful tutorial at railsforzombies.org and am now ready to get a test RoR install going. My site is on a shared host, using cPanel. I've created the test application using cPanel, and it's set up at ~/rails_apps/blog. I created a rewrite that redirects mydomain.com/testblog/ to mydomain.com:12002, which is the port that cPanel has my RoR app running on. I also started the application via cPanel, in development mode.
If I go to mydomain.com/testblog/, I see the helpful page that lets me know that my RoR app has been created and is functioning. Great, right? Well, not so fast.
I'm following along with the Getting Started guide at guides.rubyonrails.org/v2.3.8/getting_started.html, and I get to step 4. I've run script/generate controller home index and edited the resulting view at app/views/home/index.html.erb. It's just a simple
<h1>Hello rails!</h1>
However, when I go to mydomain.com/testblog/home/index (with or without the trailing '/'), I get a blank page in my browser, nothing at all (View Source shows nothing).
To make sure that I'm not going crazy, I put a text file in my rails app's /public directory, and when I go to mydomain.com/testblog/test.txt, it gets served properly. So I know that the Apache rewrite from cPanel is working properly.
Any ideas? I figure I'm overlooking something that's obvious, but I'm drawing a blank for now.
For reference, I'm running on cPanel 11, Ruby 1.8.7 and Rails 2.3.8. I would love to be running Rails 3.0, but the shared host says it's a no-go for now.
edited to add:
Generating the home controller and index action above added the following lines to my routes.rb file (I've checked, they're there):
map.connect ':controller/:action/:id'
map.connect ':controller/:action/:id.:format'
so mydomain.com/testblog/home/index should map to app/views/home/index.html.erb.
Edited again with more investigation details:
I found something that may shed some light on this. If I stop the rails app in cPanel, then log in via PuTTY and start the dev server with script/server and execute
curl http://0.0.0.0:3000/home/index
the dev server does respond with
<h1>Hello Rails!</h1>
from app/views/home/index.html.erb. So it's working there. It's when I start the Rails app in cPanel (which tells me its running on port 12002) that I get an empty response from mydomain.com/testblog/home/index. I also get an empty response from
curl http://0.0.0.0:12002
if I run it via SSH on the server. So it looks like something screwy with cPanel, not with Rails.
Did you make sure and delete your index.html file in the app/public directory of your app?
Also, after generating the home controller, did you setup your routes.rb to recognize the new controller and action?

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

Adding wordpress Blog in a Rails application

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.

Resources