ubuntu mongrel-cluster nginx

1. custer
   gem install mongrel_cluster

   $ sudo mongrel_rails cluster::configure -e production \
    -p 8000 -N 4 -c /var/www/apps/testapp -a 127.0.0.1 \
    --user mongrel --group mongrel


   $ sudo mongrel_rails cluster::start

2. nginx
   sudo apt-get install nginx


ubuntu:/etc/nginx$ cat nginx.conf
user www-data;
worker_processes  2;

error_log  /var/log/nginx/error.log;
pid        /var/run/nginx.pid;

events {
    worker_connections  1024;
    # multi_accept on;
}

http {
    include       /etc/nginx/mime.types;

    access_log /var/log/nginx/access.log;

    sendfile        on;
    #tcp_nopush     on;

    #keepalive_timeout  0;
    keepalive_timeout  65;
    tcp_nodelay        on;

    gzip  on;
    gzip_disable "MSIE [1-6]\.(?!.*SV1)";

    #include /etc/nginx/conf.d/*.conf;
    #include /etc/nginx/sites-enabled/*;

    upstream mongrel {
        server 127.0.0.1:8000;
server 127.0.0.1:8001;
server 127.0.0.1:8002;
server 127.0.0.1:8003;
   }

  server {
    listen       80;
    server_name  sample.com;
    root /var/www/apps/testapp;
    index  index.html index.htm;
    location / {
      proxy_set_header  X-Real-IP  $remote_addr;
      proxy_set_header  X-Forwarded-For $proxy_add_x_forwarded_for;
      proxy_set_header Host $http_host;
      proxy_redirect off;
      if (-f $request_filename/index.html) {
        rewrite (.*) $1/index.html break;
      }
      if (-f $request_filename.html) {
        rewrite (.*) $1.html break;
      }
      if (!-f $request_filename) {
        proxy_pass http://mongrel;
        break;
      }
    }
    error_page   500 502 503 504  /50x.html;
    location = /50x.html {
      root   html;
    }
  }

}

  sudo /etc/init.d/nginx restart



你可能感兴趣的:(html,nginx,ubuntu,Access,Rails)