/etc/nginx/nginx.conf好像:
user  deploy;
worker_processes  5;
error_log  logs/error.log;
events {
    worker_connections  1024;
    use epoll;
}
http {
    include       mime.types;
    default_type  application/octet-stream;
    sendfile        on;
    keepalive_timeout  65;
    upstream foreman4000 {
        server x.x.x.x:4000;
        server x.x.x.x:4001;
        server x.x.x.x:4002;
        server x.x.x.x:4003;
        server x.x.x.x:4004;
    } 
   server {
      listen       80;
      server_name  x.x.x.x;    #server IP
      access_log  /opt/nginx/foreman4000.access.log;
      location / {
        proxy_pass http://foreman4000;
        proxy_set_header Host $host;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $remote_addr;
      }
   }
}
这里我使用 gem foreman,它使用 upstart 来管理所有进程并用一个命令启动所有服务器
我在项目的主目录中创建了 Procfile,其中包含:
redis:  redis-server
thin:   bundle exec thin start -p $PORT
faye:   rackup faye.ru -E production -s thin
添加到 Gemfile:
gem 'foreman'
gem 'thin'
gem "foreman-export-daemontools", "~> 0.0.1"
Ran bundle install local to edit Gemfile.lock 在服务器上部署的项目。
启动 Nginx
deploy@dcards101:/opt/nginx/conf$ sudo /etc/init.d/nginx stop   [ OK ]
deploy@dcards101:/opt/nginx/conf$ sudo /etc/init.d/nginx srart  [ OK ]
将数据从 Procfile 导出到 Upstart
deploy@dcards101:/var/www/cards/current$ rvmsudo foreman export upstart -a cards -u root
开始申请
deploy@dcards101:/var/www/cards/current$ rvmsudo start cards
现在一切都必须很好,但我在服务器上看到的只是
502 Bad Gateway
nginx/1.0.15
日志说:
2012/07/17 17:22:30 [error] 11593#0: *148 no live upstreams while connecting to upstream, client: x.x.x.x, server: x.x.x.x, request: "GET / HTTP/1.1", upstream: "http://foreman4000/", host: "x.x.x.x"
请尽你所能提供帮助。服务器——Ubuntu 10 LTS。