run ruby on rails on apache-mongrel 使用apach mongrel協作建立多網域名稱的virtualhost

來源:互聯網
上載者:User

這篇文章很久以前寫的,找不到post到哪兒去了,再發一遍。因為oe.monweb.cn上的文章google是搜不到的(這是一個feature,叫做anti search engine  )

不過申明,ase和最近的google事件沒有任何關係,只是覺得使用者可能不想讓自己的文章在發布之前被別人搜到而已。開心寫作網只是一個專業寫作工具,不是blog網站。

This is a way to run ruby on rails, since rails will never support fastcgi.

All operation is following the nice artile http://wiki.rubyonrails.org/deployment/apache-mongrel

Pre-requisites

mod_proxy and mod_rewrite enabled.

Step1 Create vhost


       ServerAdmin jackie.ju@gmail.com
       ServerName oe.monweb.cn
       DocumentRoot /var/www/oe/public
        ErrorLog /var/log/httpd/oe-error_log
        CustomLog /var/log/httpd/oe-access_logs combined

    RewriteEngine On

        BalancerMember http://127.0.0.1:6010 retry=10
       BalancerMember http://127.0.0.1:6011 retry=10
       BalancerMember http://127.0.0.1:6012 retry=10
 

  # PERFORMANCE: If no static file exists, let Mongrel handle the request
  RewriteCond %{DOCUMENT_ROOT}/%{REQUEST_FILENAME} !-f
  RewriteRule ^/(.*)$ balancer://mongrel_cluster%{REQUEST_URI} [P,QSA,L]


 

Step2 install mongre-cluster

 sudo gem install mongrel_cluster

you can start/stop/restart by commands

$ mongrel_rails cluster::start$ mongrel_rails cluster::stop
$ mongrel_rails cluster::restart

Step3 start app

In rails dir

mongrel_rails cluster::configure -e production -p 6010 -N 3

OK! Done

This article is created by 開心寫作網

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

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.