Once upon a time there was somebody how wants to create a ruby on rails application running on Windows …
Normaly a bad decision, because Windows is not a good development and runtime environment regarding ruby on rails etc.
But the customer only wants windows and what else counts ;-)
So I implemented the application and everything works fine for some time.
But then, one day the chrome browser went secure, also on mobiles …
That sounds not to be a problem, but due to the camera api it means chrome does not further accept access from scripts got from an insecure server, means not using https.
So what is the solution. Go HTTPS.
On windows this is a challenge, or simply was a challenge to me and others on the web.
But finally I got it running and here is how.
First you have to install the IIS from windows through the Microsoft Web Platform Installer.
And you also need the HttpPlatformHandler, also hidden here ;-)
You also should have done an installation of ruby and ruby on rails, maybe simply by using the RailsInstaller.
Be sure that your applications works as expected by running it in a normal rails console.
Then the next step is to start the Manager for the IIS using the control panel and administration. You should see something like this in the language of your environment.
Here we will add our new website. Select the Sites folder and create a new website with a right click of the mouse.
This should lead you to the next dialog. Fill in the selected fields and end with OK. You can use any sitename you like. The path should be the root path to your ruby on rails application. Do not forget to select https, if you want a secure connection and also select a certificate — in my case a development certificate.
You also need a configuration file in your application path, so that IIS knows how to start and serve your website. So create a new web.config in your application directory and add the following:
<?xml version=”1.0" encoding=”UTF-8"?>
<add name=”httpplatformhandler” path=”*” verb=”*” modules=”httpPlatformHandler” resourceType=”Unspecified” requireAccess=”Script” />
<httpPlatform stdoutLogEnabled=”true” stdoutLogFile=”rails.log” startupTimeLimit=”20"
arguments=”"C:\RailsInstaller\Ruby2.1.0\bin\rails" server -p %HTTP_PLATFORM_PORT% -b 127.0.0.1">
<environmentVariable name=”RAILS_ENV” value=”production”/>
Check your paths to ruby and rails ;-)
Also check that you already started an application pool, otherwise it does not work. Use the following dialog to start it.
In the end configure ssl for you application, if you need to …
… and restart it.
After this you should get a running rails application right beyond your secure ip and the default port.
In the end I missed also to open the firewall for the used port. But after that everything works as expected.
Hope this helps someone.
Missing something? Comments and suggestions are welcome.