Skip to content

Instantly share code, notes, and snippets.

@forsaken1
Created September 8, 2016 01:18
Show Gist options
  • Save forsaken1/5865b3c095a62133bff89065603946ab to your computer and use it in GitHub Desktop.
Save forsaken1/5865b3c095a62133bff89065603946ab to your computer and use it in GitHub Desktop.
Sinatra Thin nginx config
service nginx start
thin start -s 2 -C /etc/thin/myapp.yml -R config.ru
thin restart -C /etc/thin/myapp.yaml
upstream www_example_com {
ip_hash;
server unix:/var/www/example.com/public_html/tmp/sockets/thin.0.sock max_fails=1 fail_timeout=15s;
server unix:/var/www/example.com/public_html/tmp/sockets/thin.1.sock max_fails=1 fail_timeout=15s;
}
server {
listen 80;
server_name example.com www.example.com;
location / {
proxy_pass http://www_example_com;
proxy_set_header HOST $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
root /var/www/example.com/public_html;
access_log /var/log/nginx/access.log;
error_log /var/log/nginx/error.log;
}
user: root
group: root
pid: tmp/pids/thin.pid
timeout: 30
wait: 30
log: /var/log/thin/thin.log
max_conns: 1024
require: []
environment: production
max_persistent_conns: 512
servers: 2
onebyone: true
threaded: true
no-epoll: true
daemonize: true
socket: tmp/sockets/thin.sock
chdir: /var/www/example.com/public_html
tag: example aux
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment