FAQ

Page Discussion Edit History

SimpleRubyFCGI

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