簡単なRuby FCGI

以下の最小限の設定はソケットを使ってunicorn あるいはthinのようなrubyアプリケーションサーバにプロキシします。

以下の幾つかの値は、httpユーザおよび/srv/httpディレクトリのようなLinuxアーキテクチャに固有なため、ディストリビューションあるいはプロジェクトに適切なように置き換えてください。

user http;
worker_processes  3;

events {
    worker_connections  1024;
}

http {
    include            mime.types;
    default_type       application/octet-stream;
    sendfile           on;
    tcp_nopush         on;
    keepalive_timeout  65;
    gzip               on;
    gzip_types         text/plain text/css text/javascript
                       application/javascript application/json
                       application/xml;
    index              index.html index.htm;

    server {
        listen       80;
        server_name  .example.com;
        root         /srv/http/my_app/public;
        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;
            proxy_pass        http://unix:/var/run/my_app.sock:;
        }
    }
}
TOP
inserted by FC2 system