I'm struggling to get Nginx to proxy my :80 traffic onto my thin cluster.
At the moment.. nothing happens. See http://ec2-50-19-75-170.compute-1.amazonaws.com/
See below for my config files:
My etc/nginx/sites-enabled/dankit config file looks likes this
upstream thin {
server 0.0.0.0:3000;
server 0.0.0.0:3001;
server 0.0.0.0:3002;
}
server {
listen 80;
server_name ec2-50-19-174-64.compute-1.amazonaws.com;
root /home/ubuntu/apps/dankit-rails;
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 false;
if (-f $request_filename/index.html) {
rewrite (.*) $1/index.html break;
}
if (-f $request_filename.html) {
rewrite (.*) $1.html break;
}
if (!-f $request_filename) {
proxy_pass http://thin;
break;
}
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
}
I then ran: sudo ln -s sites-available/dankit sites-enabled/dankit
/etc/thin/dankit.yml
pid: tmp/pids/thin.pid
address: 0.0.0.0
timeout: 30
port: 3000
log: log/thin.log
max_conns: 1024
require: []
max_persistent_conns: 512
environment: production
servers: 3
daemonize: true
chdir: /home/ubuntu/apps/dankit-rails
and just to confirm both are running:
ubuntu@domU-12-31-39-06-7A-F8:/etc/nginx/sites-available$ ps -ef | grep -i thin
root 923 1 2 16:06 ? 00:00:09 thin server (0.0.0.0:3000)
root 934 1 1 16:06 ? 00:00:09 thin server (0.0.0.0:3001)
root 945 1 1 16:06 ? 00:00:08 thin server (0.0.0.0:3002)
ubuntu 971 817 0 16:14 pts/0 00:00:00 grep -i thin
ubuntu@domU-12-31-39-06-7A-F8:/etc/nginx/sites-available$ ps -ef | grep -i nginx
root 542 1 0 16:04 ? 00:00:00 nginx: master process /usr/sbin/nginx
www-data 545 542 0 16:04 ? 00:00:00 nginx: worker process
My thin servers start OK and the logs in the rails dir don't show any errors.
I'm starting to think it's a security issue with an ec2 security group. I have however added TCP for 0.0.0.0/0 3000-3030 and the usual :80 and ssh.
This is driving me mental! Any suggestions would be greatly appreciated.