Say goodbye to the nightmare of ROR windows deployment-use Apache to deploy Ruby on Rails on Windows

Source: Internet
Author: User
Tags ruby on rails


Today, I went to cyberspace to deploy my website for my friends. The server is a Windows2003 server. I did not expect to configure ror on Windows2003 as a nightmare, because I saw a lot of IIS and ror documents on the Internet. If you don't know, it's a nightmare. I was too busy till five o'clock P.M., but I still didn't configure it. I came back at night and thought about it. Something is wrong. It may be okay to change my mind.



The general idea is to install an Apache listener to port 8080, and then use Apache to switch to mongrel. Let's talk about the specific steps.


    1. first, download Ruby for Windows from the Internet. install it. Remember to install gem.
    2. install rails, mongrel, and mongrel_servicegem install rails
      gem install win32-service
      gem install mongrel
      gem install mongrel_service
    3. prepare the ROR Program and I will have the OK Yamada Program
    4. Add the ROR program as a Windows Service
      mongrel_rails service: Install-N MyApp-C: \ MyApp-P 4000-e production
      you can also use mongrel_rails service: Remove-N MyApp to delete it.
      now you can register as a service to manage your website in the control panel, administrative tools, and services. If it is set to auto start, it will be OK.
    5. after installing Apache, select the option that uses port 8080 to prevent conflicts with IIS. However, modify the httpd. conf file and cancel the comments of the three lines.
      loadmodule proxy_module modules/mod_proxy.so loadmodule proxy_connect_module modules/mod_proxy_connect.so loadmodule proxy_http_module modules/mod_proxy_http.so
    6. in httpd. add the proxy pass setting in Conf.
      proxypass/MyApp http: // 127.0.0.1: 4000/
      proxypassreverse/MyApp http: // 127.0.0.1: 4000/


In this way, you can use http: // 127.0.0.1: 8080/MyApp for access. However, there is a problem, that is, your images and CSS cannot be displayed due to path issues. The solution is shown in javaeye.Code, Or add several lines of code at the end of httpd. conf. Of course, the proxy above should be deleted.


Proxyrequests off

<Proxy balancer: // mycluster>

Balancermember http: // localhost: 4000

Balancermember http: // localhost: 4001

</Proxy>

<Virtualhost *: 8080>

Servername www.cpu123.com

DocumentRoot D:/sdroad/Public

Proxypass/images!

Proxypass/stylesheets!

Proxypass/javascripts!

Proxypass/balancer: // mycluster/

Proxypassreverse/balancer: // mycluster/

Proxypreservehost on

</Virtualhost>



Okay, it's all done. You have time to configure it in the city. I find myself stubborn sometimes, and I can't stand what I want to accomplish without making it. If you don't get it out, you have to go to bed.


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.