Use apache2.2 and mongrel to run Ruby on Rails on Windows.

Source: Internet
Author: User
1. Install Ruby, rails, mongrel, and apache2.2 download one-click Ruby install from the rubyforge website and run the installation program. Then Ruby and rubygems are installed. Run the command: Gem install rails-ygem install mongrel-ygem install mongrel_service-y. After rails and mongrel are installed, download apache2.2 for Windows from the Apache website. After running the installation program, apache2.2 is installed. 2. Start mongrel as a service to start mongrel_rails service: Install-N depot-c d:/rubyproject/depot-P 3000-e production-N to specify the service name, -D indicates the directory of the rails application.-P indicates the TCP port of the mongrel listener, and-e indicates the production mode. In this way, the control panel is opened. | administrative tool | service, you can find that you have added a service named "depot" to manage the service through the control panel. If you need a command line to start and close the service, then: mongrel_rails service: Start-N depotmongrel_rails service: Stop-n depot if you need to log out of the service, then: mongrel_rails service: Remove-N depot if you need to install multiple mongrel instances, you can do this: mongrel_rails service: Install-N depot0-c d: /rubyproject/depot-P 3000-e productionmongrel_rails service: Install-N depot1-c d:/rubyproject/depot-P 3001-e production and so on. 3. Configure apache2.2 and use the editing tool to open CONF/httpd under the directory apache2.2. conf, you need to cancel the comments of the following modules: loadmodule proxy_module modules/mod_proxy.soloadmodule proxy_balancer_module modules/mod_proxy_balancer.soloadmodule proxy_http_module modules/modules if you want to compress the page output, you also need to cancel comm: loadmodule deflate_module modules/mod_deflate.so and configure HTTP Proxy-based load balancing as follows:

XML Code
  1. Proxyrequests off
  2. <Proxy balancer: // mycluster>
  3. Balancermember http: // localhost: 3000
  4. Balancermember http: // localhost: 3001
  5. </Proxy>
  6. <Virtualhost *: 80>
  7. Servername www.xxx.com
  8. DocumentRoot D:/rubyproject/Depot/Public
  9. Proxypass/images!
  10. Proxypass/stylesheets!
  11. Proxypass/javascripts!
  12. Proxypass/balancer: // mycluster/
  13. Proxypassreverse/balancer: // mycluster/
  14. Proxypreservehost on
  15. </Virtualhost>

Mycluster defines each mongrel application server node in the cluster. Proxypass/images! Requests starting with this URL are not forwarded to the mongrel cluster, but are processed by Apache itself. Restart Apache, open a browser to access www.xxx.com, and check whether the configuration is correct. So far, a Ruby on Rails production environment with good stability and performance has been built on Windows server. For page output, you can also use mod_deflate to compress the output content to increase the page download speed, which is left for your own configuration.

Related Article

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.