开发者

Using IIS to host a rails server

I am currently hosting a rails server. When I go to http://localhost:3000 I can view the application and everything.

Now I am trying to set it up as a website that can be viewed from the outside world using IIS. I dragged it into c:\inetpub\wwwroot but when 开发者_如何学编程 Iright click on browse in IIS it tells me that "The website declined to show this webpage." Note that I do allow anonymous access.

Is there some other step to setting up a rails application this way? The only experience I have is hosting an asp.net application.


You'll want to check out Ruby On Rails for IIS. It leverages a few community technologies to run your Rails application inside of an IIS site.

It's still kinda ugly though!


You can use HttpPlatformHandler

install it with Web Platform Installer and add web.config in root of rails application directory.

input this in web.config

<configuration>
    <system.webServer>
        <handlers>
            <add name="httpplatformhandler" path="*" verb="*" modules="httpPlatformHandler" resourceType="Unspecified" requireAccess="Script" />
        </handlers>
        <httpPlatform stdoutLogEnabled="true" stdoutLogFile="rails.log" startupTimeLimit="20" processPath="c:\RailsInstaller\Ruby2.1.0\bin\ruby.exe"
                  arguments="&quot;C:\RailsInstaller\Ruby2.1.0\bin\rails&quot; server -p %HTTP_PLATFORM_PORT% -b 127.0.0.1">
            <environmentVariables>
                <environmentVariable name="foo" value="bar"/>
            </environmentVariables>            
        </httpPlatform>
    </system.webServer>
</configuration>

You want to see Announcing: Running Ruby on Rails on IIS8 (or anything else, really) with the new HttpPlatformHandler


I would recommend using Heroku. It's free to use (but you can pay for some better stuff) and comes with an easy gem to work with it. It's read only though, so if you do any file uploading try using Amazon S3. It's pretty easy to set up with a domain name too.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜