Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
483 views
in Technique[技术] by (71.8m points)

installation - How to install Ruby on Rails alongside WampServer?

Is is possible to install Ruby on Rails alongside WampServer (and keep WampServer's Apache/MySQL installs)?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

I installed Ruby on Rails alongside WampServer. Here is how to do it:

Replace C:wamp in the following text by your own WampServer's install repository.

Installing Ruby:

  1. Download Ruby. Use the Windows binary version, not the "one click installer" because it contains MySQL and Apache which we don't need.
  2. Extract the zip to C:wamp uby.
  3. Add Ruby's bin repository in your PATH environment variable:

    1. Right click "Computer / Properties".
    2. Click "Advanced System Settings".
    3. Advanced tab / Environment Variables.
    4. Append ;C:wamp ubyin to the Path variable.

Installing DevKit:

Download DevKit:

  1. Extract DevKit to c:wamp ubyDevKit.
  2. cd /d c:wamp ubyDevKit.
  3. ruby dk.rb init.

    • Add - c:wamp uby to the end of config.yml.
  4. ruby dk.rb install

Installing Rails and the Mongrel server:

  1. Open the command line and type:

    gem install rails
    
  2. Create your first Rails application by opening the command line from C:wampwww ails and typing:

    rails hello
    
  3. Install the Mongrel server and Windows Mongrel service, making sure to run the command line as administrator:

    gem install mongrel and 
    gem install mongrel_service
    
  4. Install a Windows service for your Rails application:

    mongrel_rails service::install -N ruby-hello -c c:wampwww
    ailshello -p 3001 -e development
    
  5. Start your Mongrel service:

    net start ruby-hello
    

You can now access your Rails application at http://localhost:3001/.

Integrating with Apache

  1. Enable mod_proxy in httpd.conf

    Open httpd.conf (c:wampinapacheApache2.x.xconfhttpd.conf) and uncomment the following line:

    LoadModule proxy_module modules/mod_proxy.so
    
  2. Forward your traffic to your Mongrel server. Add the following text to your httpd.conf (or extra/httpd-vhosts.conf if it's included in your httpd.conf):

    <VirtualHost *:80>
    ServerName hello.com
    ServerAlias *.hello.com
    ProxyPass / http://localhost:3001/
    ProxyPassReverse / http://localhost:3001
    </VirtualHost>
    
  3. Add hello.com to your hosts file. Open c:windowssystem32driversetchosts in Notepad and add the following line:

    127.0.0.1 www.hello.com hello.com
    

You can now go to http://www.hello.com and it should load your Rails application.

References:


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...