Forum Discussion
Lobby1625
Sep 25, 2024Copper Contributor
How to Host a Rails App on IIS: Seeking a Simple Approach
Hello,
I’m having trouble hosting my Rails app on IIS (Windows Server 2019). Unfortunately, I don’t have the option to choose a different server since the app will be hosted on an on-premise server, which also runs other applications on IIS (Windows Server 2019). I’ve read numerous discussions on this topic, and the most common feedback is that “it’s painful.” However, I haven’t been able to find a clear, step-by-step guide or solution.
So far, I’ve come across the following options:
- Hosting with a reverse proxy
- Hosting with WSL
- Hosting with Docker
However, I’m looking for a more traditional approach to hosting the app, similar to how one would typically host an application in other languages.
As a developer with limited experience in server management, I’m not sure where to start. If anyone has any tips, tutorials, or guidance, I would greatly appreciate your help!
- HridayDutta
Microsoft
You can use HttpPlatformHandler, it is an IIS Module, which manages the process of http listeners. It could be any process that can listen on a port for http requests e.g. Tomcat, Jetty, Node.exe, Ruby etc. Checkout this article for more details HttpPlatformHandler Configuration Reference | Microsoft Learn.
- Lobby1625Copper Contributor
HridayDutta Thanks for your reply ! I tried to make this method working but I got :
HTTP Error 502.3 - Bad Gateway There was a connection error while trying to route the request.
I've found some examples of web.config for rails on the web (very old), but I'm pretty sure i'm missing something. Here is my configuration :
<?xml version="1.0" encoding="UTF-8"?> <configuration> <system.webServer> <handlers> <add name="httpplatformhandler" path="*" verb="*" modules="httpPlatformHandler" resourceType="Unspecified" requireAccess="Script" /> </handlers> <httpPlatform stdoutLogEnabled="true" processesPerApplication="1" startupTimeLimit="200" processPath="C:\Ruby32-x64\bin\ruby.exe" arguments=""C:\Ruby32-x64\bin\puma" -env test -dir c:\inetpub\wwwroot\myapp -p %HTTP_PLATFORM_PORT% -w0"></httpPlatform> </system.webServer> </configuration>
Additionnaly, I've found on this link talking about "SysInternals Process Explorer application" that show me processes under IIS and I can see ruby running for a second then disappear. I can't find anything about this have you got an idea ?
Thank you for your help !
- Lobby1625Copper ContributorI found the problem. It was about puma service not running because of misconfiguration. Now my rails app run perfectly on IIS