jpablobr.com

→ ror getting started with your hosting provider

More on: hosting, RoR, Wed May 13 21:40:40 -0600 2006

Now day’s most hosting providers are supporting RoR in one way or another. (here is a full list from the RoR official site) However, there isn’t much information about getting started with out to mention that some info according to my experience doesn’t work. Besides, I don’t understand very well why the hosting companies don’t provide “how-to’s” or at least better guidance. Therefore, I’m writing this post in order to explain how I set up my first test app. (it may vary a little bit from hosting provider to another)

First, you have to request SSH access to your server. Most likely they will grant you “jailed SSH”. (On a down note, “jailed SSH” means that not everything that a user could do with a shell command is available. On the up side, because not all commands are available, the security of the web server your account is on remains intact. )

Now that you have SSH access, you would be able to login into your web server using any SSH client like Putty. (You can download it here.)

There is how I used it;

Double click Putty, enter your web server domain and use the provided port by your hosting company. Then click the Save button (right side of the window).

jpablobr

Click “Keyboard” under “Terminal” on the left and select Control-H under “The Backspace key” so that it looks like this…

jpablobr

Click “Connection” (on the left) and make the window look like this...

jpablobr

Click “Session” (on the left) to return to the first screen. Click “Save” (on the right). Make sure that you click Save!

Now that you configured Putty. In order to Login in to your SSH account, double click the saved “session” and enter your credentials.

Once logged in make sure you are in your /home/username folder using the “pwd” command.

It should show the output like this :

Code:

cpaneluser@server [~]# pwd /home/cpaneluser

Then run the following commands to generate a demo rail app and its controller.

Code:

cpaneluser@server [~]# rails /home/cpaneluser/demoapp cpaneluser@server [~]# cd demoapp cpaneluser@server [~]# ruby script/generate controller test

Now create a symlink in public_html so that the app is viewable via the web.

Code:

cpaneluser@server [~]# cd ../public_html cpaneluser@server [~]# ln –s ../demoapp/public rails

Before you test the Rails page, there is one more modification you need to make.

Code:

              
                cpaneluser@server [~]# cd ../demoapp/public
              
            
cpaneluser@server [~]# pico .htaccess

And save the file.

You can then visit http://yourdomain.com/rails/ and you should see a “Welcome Aboard” page which confirms successful working of your test rail app.

Also note that when you’re done, navigating to www.mydomain.com/rails still might throw a 400 Error: Bad Request. That’s because you’re trying to navigate to a file. What you want is to navigate to a directory. Solution: go to www.mydomain.com/rails/ instead (note the trailing slash).

Share and Enjoy:

jpablobr
blog comments powered by

Disqus