FAQ

Page Discussion History

SimpleRubyFCGI

Revision as of 04:24, 14 September 2011 by Towynlin (Talk)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

The following minimal config will proxy to a ruby application server such as unicorn or thin via a socket.

Some values below are specific to Arch Linux such as the http user and the /srv/http directory, so replace as appropriate for your distribution or project.

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:;
        }
    }
}