Previous page | Next page | Locate page |

#### Installing Ruby Web Applications (Linux Hosting)

You can install on your site custom Web applications developed in the Ruby programming language.

To install on your site an application written in Ruby:

1. Go to Domains > domain name > Web Hosting Settings (in the Web Site group).
2. Select the CGI and FastCGI check boxes, and click OK.
3. Connect to your FTP account, change to the `/httpdocs` directory, and create a subdirectory where the application files will reside. Let's call this directory `<your_application>`, for illustration purposes.
4. Upload the application files to the `httpdocs/<your_application>` directory.
5. Locate the `readme` file in the application directory. Follow the instructions from this file to install the application. Note that installation of additional Ruby modules or operating system components may be required. In such a case, contact your hosting service provider or server administrator for assistance.
6. Log in to the server shell over SSH and issue the command `cd /<path_to_virtual_hosts>/<your_domain_name>/httpdocs; mv <your_application> <your_application>.real; ln -s <your_application>.real/public <your_application>`

   where <path_to_virtual_hosts> is the path to the directory with virtual host configuration files, <your_domain_name> is the name of your domain, and <your_application> is the directory where your Ruby application is located.

   If you do not have access to server shell, ask your server administrator or hosting service provider to perform this step for you.

7. Create a file with name `.htaccess` in the directory <your_domain_name>/httpdocs/<your_application>/public, open it with a text editor of your choice and add the following lines into the file:

   `AddHandler fcgid-script .fcgi`

   `Options +FollowSymLinks +ExecCGI`

   `RewriteEngine On`

   `RewriteBase /``<your_application>`

   `RewriteRule ^$ index.html [QSA]`

   `RewriteRule ^([^.]+)$ $1.html [QSA]`

   `RewriteCond %{REQUEST_FILENAME} !-f`

   `RewriteRule ^(.*)$ dispatch.fcgi [QSA,L]`

   `ErrorDocument 500` `"<`h2>Application error</h2>Rails application failed to start properly"``

8. Save the file.
9. Make sure that the proper path to the Ruby interpreter is specified in the file `public/dispatch.fcgi`: issue the commands `head -n1 dispatch.fcgi` and `which ruby`. The both commands must return identical values.

Now the Web application will be accessible at the following URL: http://your-domain.com/your_application.