Deploy Ruby On Rails To A Shared Host (part 2 – Server Setup)
The next step in deploying a Rails application is the setup of the server. For this we will use SSH. As mentioned in Part 1 of this series of deploying a Rails application I use putty as my SSH client.
1. Log into your account with your SSH client and go into your root directory.
cd ~
2. Setup permissions for your application. Enter the following command:
chmod -R 755 your_app/*
3. Update your .htaccess file in your Rails public directory to include the following line (place as the last RewriteRule). You can use vi to handle this task (vi ~/your_app/public/.htaccess):
RewriteRule ^(.*)$ dispatch.fcgi [QSA,L]
4. Create a symbolic link from your public_html directory to your Rails application. Note: You have two options here. One, you can just point the public_html directory directly at your public folder inside your Rails Application or you can create a subdirectory inside public_html and point that sub directory at your Rails public folder. For my needs I just want the public_html directory to point at my app. So for one time setup I will backup my public_html directory than create the symlink.
mv public_html public_html_back ln -s ~/appname/public ~/public_html
5. Restart your application with the following command:
pkill -9 -u lovethec -f dispatch.fcgi
6. Use a browser and hit your application. Assuming all went well with setup you should see your application home page when you go to your production root url. So for me I go to http://www.lovethecrud.com/.
The next post will cover tips on managing your FastCgi processes.
References
No comments yet
Leave a reply
RSS - Posts