New tutorial: Westhost on Rails

I have been hosting on Westhost for a little over four years now with no major complaints and I also host the majority of my clients there. They offer a lot of options for very little money and are always adding new features to the accounts. Unfortunately, Ruby on Rails is not one of them… yet.

As I have begun working a bit more with Rails, I have been looking to get it installed on my server (as well as some of my clients’). One of the major half-truths of Rails evangelism is the ease of install, especially with a host running Apache 1.3. After doing a few rather painful installs myself for some new projects, I finally decided to document the process of installing Ruby on Rails at Westhost for my own knowledge and to help any others who may be trying to do the same. Hopefully, Westhost will soon start to offer Rails installs as part of their hosting packages, but, until then, I offer up this humble tutorial.

Like it? Share it

Share on LinkedIn

Share on Google Plus

Comments

  1. Thank you so much for putting this together!!!  I found it to be incredibly helpful in getting rails installed and rolling on my own westhost account!  Thanks!!!

  2. I’m getting an error when I do the <code class=“shell”>ruby script/server</code> command.  Has anyone seen this?

    <code class="shell">[2005-11-26 21:22:07] WARN  TCPServer Error: Address already in use - bind(2)
    /usr/local/ruby/lib/ruby/1.8/webrick/utils.rb:73:in 'initialize': Address already in use - bind(2) (Errno::EADDRINUSE)
    from /usr/local/ruby/lib/ruby/1.8/webrick/utils.rb:73:in 'create_listeners'
    from /usr/local/ruby/lib/ruby/1.8/webrick/utils.rb:70:in 'create_listeners'
    from /usr/local/ruby/lib/ruby/1.8/webrick/server.rb:75:in 'listen'
    from /usr/local/ruby/lib/ruby/1.8/webrick/server.rb:63:in 'initialize'
    from /usr/local/ruby/lib/ruby/1.8/webrick/httpserver.rb:24:in 'initialize'
    from /usr/local/ruby/lib/ruby/gems/1.8/gems/rails-0.14.3/lib/webrick_server.rb:61:in 'dispatch'
    from /usr/local/ruby/lib/ruby/gems/1.8/gems/rails-0.14.3/lib/commands/servers/webrick.rb:59
    from /usr/local/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:21:in 'require'
    from /usr/local/ruby/lib/ruby/gems/1.8/gems/activesupport-1.2.3/lib/active_support/dependencies.rb:214:in 'require'
    from /usr/local/ruby/lib/ruby/gems/1.8/gems/rails-0.14.3/lib/commands/server.rb:28
    from /usr/local/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:21:in 'require'
    from /usr/local/ruby/lib/ruby/gems/1.8/gems/activesupport-1.2.3/lib/active_support/dependencies.rb:214:in 'require'
    from script/server:3</code>
    • Steve
    • | #
  3. I’m certainly not an expert, but it looks like the WEBrick server is trying to use a port that is already in use. Do you already have an instance of WEBrick running? If that’s not it, you can try seeing what else may be running on port 3000.

  4. I have multiple domains pointing to different directories, with for example defaultdomain.com being the domain my westhost account was created with. It is in /var/www/html. Now I installed the demo in the tutorial under demo.anotherdomain.com.

    I have everything up and running fine. The only problem now is when I go to defaultdomain.com, I am shown the Ruby on Rails default page. All I want Ruby to point to is demo.anotherdomain.com, but it seems like it has taken over my default domain also.

    What can I do? Does it have something to do with the VirtualHosts in httpd.conf? Thanks!

  5. Without the full story (and access to your box), my best guess is that you installed your Rails app in /var/www/html/ which is why you are seeing it as the default. To accomplish what I think you want, it seems like you need to do the following

    <ul>
    <li>create a new directory for your Rails install (/var/www/rails or some such),</li>
    <li>use the WestHost Site Manager to add the “demo” hostname to your “anotherdomain.com” DNS record,</li>
    <li>point the “demo” hostname at the newly created directory (/var/www/rails), and then</li>
    <li>fix your defaultdomain.com directory.</li>
     </ul>

  6. Hmm. Rails was already installed to another directory /var/www/demo. That directory is already pointing to demo.anotherdomain.com which was created with the Site Manager.

  7. If I access http://www.defaultdomain.com, everything is fine. But if I access defaultdomain.com I get the Ruby page.

    Also, have you run into any problems after installing the mysql gem? My wordpress install is no longer connecting to the mysql database.

    On a side note, thanks for putting together an awesome tutorial!

  8. Take another look at your Domain Management tab in the Site Manager. There is a default directory for the domain (listed in the table at the bottom of the Domain Management page) and then you can click through to the domain itself via the top listing to modify the hostnames for that domain. My guess is that your domain and your www hostname are not pointing to the same place.

    As for your WordPress problem, I’m not sure what the issue is. There should be no conflict and I run WordPress and Rails together on the same box (this one) with no problems. I would check your database connection settings.

  9. The WordPress database problem has seemed to fix itself…

    I’ve triple checked my domain setup and I don’t see any problems. What’s odd is that “www.defaultdomain.com” works fine where as “defaultdomain.com” shows the ruby page. Additionally, this problem occurred after installing RoR and Fastcgi. I’ll keep looking around and going though httpd.conf. Maybe i’ll spot something. Thanks for your help!

  10. Thank you for creating this Westhost on Rails tutorial.  I just successfully set up my first rails development environment with your help.  The only thing I needed to change was this line:

    <code class="text">AddHandler fastcgi-script fcg fcgi fpl</code>

    For some reason, apache needed the . character before the suffixes:

    <code class="text">AddHandler fastcgi-script .fcg .fcgi .fpl</code>

    Without them, my browser would sit forever loading the page, and the server logs showed a timeout response.

    Thanks again.

    • Mark J Musante
    • | #