Deploy the ROR application in Apache + FastCGI in Windows

Source: Internet
Author: User
Tags redmine
System Requirements
    • Apache
    • Ruby
    • Rails

We recommend that you use Ruby 1.8.6 one-click installer instead of Ruby 1.8.6 binary, because the latter does not contain the fcgi module, even if you useGem install fcgiInstallation must be compiled before use. If the FCG module is not available, the following error may be reported when Apache starts the FastCGI process:

The pipe has been ended.: mod_fcgid: Get overlap result Error

Install rails:Gem install rails

Install Apache HTTP server.

Obtain mod_fcgid. This module depends on Visual C ++ 2008 redistributable package. Decompress mod_fcgid.so to the modules subdirectory of the Apache directory. By default, the fcgid process has only one _ fcgi_shutdown_event _ environment variable, while Windows DNS resolution must have some specific environment variables. Otherwise, DNS resolution fails and the application reports the following error:

Getaddrinfo: No address associated with hostname.

The following configuration describes how to solve the problem.

 

Here are some assumptions:

    • Ror application directory: D:/webroot/redmine/
      Initialize Database: rake DB: migrate

Configure Apache and add the following script:

Loadmodule fcgid_module et/MoD/mod_fcgid.so
Defaultinitenv rails_env Production
# Set the following environment variables to ensure correct DNS resolution
# If this parameter is not set, getaddrinfo: No address associated with hostname will be reported.
Defaultinitenv path "C:/Windows/system32; C:/windows; C:/Windows/system32/WBEM ;"
Defaultinitenv systemroot "C:/Windows"
Defaultinitenv systemdrive "C :"
Defaultinitenv Temp "C:/Windows/Temp"
Defaultinitenv tmp "C:/Windows/Temp"
Defaultinitenv WINDIR "C:/Windows"

Alias "/redmine" "D:/webroot/redmine/public /"

<Directory "D:/webroot/redmine/public/">
Options indexes execcgi followsymlinks
AllowOverride all
Order deny, allow
Allow from all
</Directory>

<Location/redmine/>
Addhandler fcgid-script. fcgi
Fcgiwrapper "C:/Ruby/bin/ruby.exe D:/webroot/redmine/public/dispatch. fcgi". fcgi
Rewriteengine on
Rewritebase/redmine
Rewriterule ^ $ index.html [QSA]
Rewriterule ^ ([^.] +) $ response 1.html [QSA]
Rewritecond % {request_filename }! -F
Rewriterule ^ (. *) $ dispatch. fcgi? $1 [QSA, l]
</Location>

2008-5-16 zealic

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.