Ruby + Rails + Gem + Mongrel Cluster + Apache + MySQL n0 Red Hat EL

Servidor Rails no Red Hat EL 4. Ruby + Rails + Gem + Mongrel Cluster + Apache + MySQL rodando uma aplicação em Rails com Mongrel em cluster gerenciado pelo Apache no Red Hat EL.

[ Hits: 48.610 ]

Por: Marcos Miras em 06/12/2007


Instalando e configurando o Mongrel com Apache / Parte 2



Inclua no final do arquivo a seguinte configuração:

<VirtualHost *>
  ServerName redhatonrails
  ErrorLog /suaapp/log/errors.log
  CustomLog /suaapp/log/apache.log combined

  <Directory "/suaapp/public/">
    Options FollowSymLinks
    AllowOverride None
    Order allow,deny
    Allow from all
  </Directory>

  RewriteEngine On

  # 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
  RewriteCond %{SCRIPT_FILENAME} !maintenance.html
  RewriteRule ^.*$ /system/maintenance.html [L]

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

  # 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]

  # Deflate
  AddOutputFilterByType DEFLATE text/html text/plain text/css
  # ... text/xml application/xml application/xhtml+xml text/javascript
  BrowserMatch ^Mozilla/4 gzip-only-text/html
  BrowserMatch ^Mozilla/4.0[678] no-gzip
  BrowserMatch \bMSIE !no-gzip !gzip-only-text/html

  <Proxy *>
    Order allow,deny
    Allow from all
  </Proxy>

  <Proxy balancer://mongrel_cluster>
    BalancerMember http://127.0.0.1:6000
    BalancerMember http://127.0.0.1:6001
    BalancerMember http://127.0.0.1:6002
    BalancerMember http://127.0.0.1:6002
    BalancerMember http://127.0.0.1:6002
  </Proxy>

</VirtualHost>

Vamos criar um arquivo de inicialização para o Mongrel Cluster:

# ln -s /usr/local/lib/ruby/gems/1.8/gems/mongrel_cluster-1.0.5/\
resources/mongrel_cluster /etc/rc.d/init.d/mongrel_cluster
# chmod +x /etc/rc.d/init.d/mongrel_cluster


Inicie o Mongrel e o Apache:

# /usr/local/apache2/bin/apachectl start
# /etc/rc.d/init.d/mongrel_cluster start


Só correr para o abraço e acessar sua aplicação...

http://ip_do_server/

É isso aí, espero ter ajudado!

Abraços,
Marcos Miras
marcosmiras@atmsystem.com.br

Página anterior    

Páginas do artigo
   1. Introdução
   2. Instalação do Ruby, Gems, Rails e MySQL
   3. Criando o banco, configurando sua aplicação e acessando
   4. Instalando e configurando o Mongrel com Apache / Parte 1
   5. Instalando e configurando o Mongrel com Apache / Parte 2
Outros artigos deste autor

PhpPgAdmin e PhpMyAdmin

Integridade dos arquivos do sistema

Introdução ao MySQL

Comunity ENTerprise Operating System, o CentOS

Leitura recomendada

ArchLinux, uma distro de expressão aqui no VOL

Instalar o TeamViewer no Ubuntu/Debian

Instalando o Linux Fedora 8 no Notebook Positivo v53

Membro da comunidade Viva O Linux na Espanha

Análise do Syllable, mais um interresante sistema operacional livre

  
Comentários

Nenhum comentário foi encontrado.


Contribuir com comentário




Patrocínio

Site hospedado pelo provedor RedeHost.
Linux banner

Destaques

Artigos

Dicas

Tópicos

Top 10 do mês

Scripts