NginX: Add Sockets for Rails Apps
For Hosting Rails Apps on my nginx server I have to configure some thin sockets for each app that is hosted.
For each Site I have to create a config-file /etc/thin/domain.de.yml and have to paste a huge amount of code into the nginx-directives of the website in ISP.
Would be great to have a input field "Number of Thin Sockets" and to have the thin configuration and code in the host file generated by ISP.
/etc/thin/domain.de.yml
pid: tmp/pids/domain.de.pid group: clientX wait: 30 timeout: 30 log: log/projects.spicyweb.de.log max_conns: 1024 require: [] environment: production max_persistent_conns: 512 servers: 4 daemonize: true user: webX socket: /var/www/clients/clientX/webX/tmp/sockets/domain.de.sock chdir: /var/www/clients/clientX/webX/web
nginx Directives: (note my use of curly brackets, 'upstream thin-cluster' must be defined outside of 'server')
proxy_set_header Host $http_host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
client_max_body_size 10m;
client_body_buffer_size 128k;
proxy_connect_timeout 90;
proxy_send_timeout 90;
proxy_read_timeout 90;
proxy_buffer_size 4k;
proxy_buffers 4 32k;
proxy_busy_buffers_size 64k;
proxy_temp_file_write_size 64k;
proxy_redirect off;
location / {
try_files $uri/index.html $uri.html $uri @cluster;
}
location @cluster {
proxy_pass http://thin_cluster;
}
} upstream thin_cluster { server unix:/var/www/clients/client1/web57/web/tmp/sockets/projects.spicyweb.de.0.sock; server unix:/var/www/clients/client1/web57/web/tmp/sockets/projects.spicyweb.de.1.sock; server unix:/var/www/clients/client1/web57/web/tmp/sockets/projects.spicyweb.de.2.sock; server unix:/var/www/clients/client1/web57/web/tmp/sockets/projects.spicyweb.de.3.sock;