zoukankan      html  css  js  c++  java
  • capistrano

    http://wiki.ocssolutions.com/Step-by-step_setup_using_Capistrano_2.0_and_Mongrel

    http://tech.wangyaodi.com/2010/07/30/study-notes-passenger-capistrano-nginx-rails-2-3-4-ubuntu-9-04-10-steps/

    http://gautamrege.wordpress.com/2009/11/10/capistrano-nginx-thin-deployment-on-linode/

    http://tech.wangyaodi.com/2010/07/30/study-notes-passenger-capistrano-nginx-rails-2-3-4-ubuntu-9-04-10-steps/

    http://jimneath.org/2008/05/10/using-capistrano-with-passenger-mod_rails/

    apache+mongrel模式在sles上的注意事项 收藏

            rails目前比较主流的部署就是利用apache加mongrel的模式,其中利用到了apache的 proxy,http_proxy,proxy_balancer以及mod_rewrite等模块,其中mongrel一侧利用 mongrel_cluster来简化多个mongrel实例的部署。

            本人在实践这个模式的时候,碰到以下几个问题,值得一提,如果你刚巧碰到类似的问题,就不必再重复研究了。

    1、静态文件无法访问。

    如果你采用capistrano自动部署,capistrano的利用symblic来组织目录结构,比如默认情况下/u/apps /appname/current/public,其中所有的release都是放在/u/apps/appname/releases /20070101012512类似的目录中,current指向(symbolic)最近发布的一个release。如果你的apache的 Directory条目指向/u/apps/appname/current/public,并且允许FollowSymLinks,但结果却无法访问 public目录下的index.html静态文件。原因就是FollowSymLinks的目标超出了Directory条目的路径。解决的办法就是将 Directory路径缩短,包括symbolic和它所指向的目标,比如将Directory变成/u/apps/appname,这样就可以访问了。

    2、cgi-bin目录无法工作。

    这个问题其实是mod_rewrite的原因,接下来将mongrel部署中推荐的rewrite方式列出来,同时解释一下各个条目,这样即使你对于mod_rewrite了解不多,也能够理解其中的原因。

    如果你有兴趣,可以将apache的mod_rewrite当作一个开发环境一样来研究,这是一个比你想象的更有用处的一个模块。

    下面的中文,是由本人注释的。

    RewriteEngine On  :开启rewrite功能(当然你必须首先load rewrite 模块)

    #Uncomment for rewrite debugging
    #RewriteLog logs/myapp_rewrite_log
    #RewriteLogLevel 9

    # 首先是RewriteRule要匹配,然后再执行RewriteCond测试,如果RewriteCond测试也通过的话,那么就执行RewriteRule中的替换。由于向来是RewriteCond在前,所以虽然RewriteRule执行在先,还是放到后面。

    # Check for maintenance file and redirect all requests
    #  ( this is for use with Capistrano's disable_web task )
      RewriteCond %{DOCUMENT_ROOT}/system/maintenance.html -f :-f表示前面的路径存在,并且是一个普通的文件
      RewriteCond %{SCRIPT_FILENAME} !maintenance.html :表示请求的文件名不是maintenance.html
      RewriteRule ^.*$ /system/maintenance.html [L] :^.*$表示匹配任何路径

      合起来表述:如果%{DOCUMENT_ROOT}/system/maintenance.html存在,并且请求的不是 maintenance.html,那么对于任何路径的请求,都改写成对/system/maintenance.html的请求,并且这个 RewriteRule匹配之后,不再对后面的RewriteRule进行处理。(因为有[L]标记)

    # if cgi-bin,then stop RewriteRule
      RewriteRule ^/cgi-bin/upload\.py$ /cgi-bin/upload.py [QSA,PT,L]
    QSA表示将原来的query string部分加上去,而PT表示经过RewriteRule之后,还要继续进行uri到filename的转换,比如alias,scriptalias等等,L表示最后一个RewriteRule.

    # Rewrite index to check for static
      RewriteRule ^/$ /index.html [QSA]

      将/替换成/index.html,QSA表示将原来的query string部分添加上去。

    # Rewrite to check for Rails cached page
      RewriteRule ^([^.]+)$ $1.html [QSA]

    # Redirect all non-static requests to cluster
      RewriteCond %{DOCUMENT_ROOT}/%{REQUEST_FILENAME} !-f
      RewriteRule ^/(.*)$ balancer://mongrel_cluster%{REQUEST_URI} [P,QSA,L]

  • 相关阅读:
    AS快捷键的设置
    hausaufgabe--python 23- Recurse 2
    hausaufgabe--python 22- Recurse
    hausaufgabe--python 21_ Lambda
    hausaufgabe--python 20-Closure functions 2
    hausaufgabe--python 20- usage of Closure
    hausaufgabe--python 19- Functions 2
    hausaufgabe--python 18- Defined specific Functions
    hausaufgabe--python 17- Function definition
    hausaufgabe--python 16- Sequenz
  • 原文地址:https://www.cnblogs.com/lexus/p/1910960.html
Copyright © 2011-2022 走看看