Deploying a Ruby on Rails application with Gandi AI

Installation of the application

Install your application normally. If you need dependencies to be installed, log in SSH with the user “admin” use the gem” command.

Hide the "public" directory of URL

By default, your application is accessible via a URL such as http://your-virtualhost/public/. Most likely, you do not want the /public/ directory to be visible.

You need to create a .htaccess in the “htdocs” folder with the following setting:

RewriteEngine On
RewriteRule ^$ /public/ [L]
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ /public/$1 [L]

Your application is now directly accessible via the URL http://your-virtualhost/.

In this example, your application is installed at the root of your virtualhost. If you did not install it there, simply add a “RewriteBase /subdir” under the “RewriteEngine On” line if your application is in the /subdir folder for instance, and create the .htaccess file in the same folder.

最后更改: 2016/06/08 08:46 (外部编辑)