Centos6上的nginx + Unicorn + Sinatra出现502错误

时间:2014-02-07 07:28:52

标签: nginx sinatra vagrant unicorn

我在Vagrant上设置了CentOS6盒子,试图运行Sinatra + Unicorn + NGINX环境。我的/etc/nginx/nginx.conf如下所示:

upstream app1 {
    server unix:/tmp/app1.sock fail_timeout=0;
}
server {
    listen 80;
    server_name 192.168.33.10;

    location / {
    if (-f $request_filename) {
        break;
    }
        root /vagrant/workspace/public;
        proxy_pass http://app1;
        proxy_set_header Host $host;
    }
    location ~* \.(ico|css|js|gif|jpe?g|png)(\?[0-9]+)?$ {
    expires 1y;
    }
}

我的unicorn.rb文件如下所示:     @path =“/ vagrant / workspace /”

worker_processes 1
working_directory @path
timeout 15
listen '/tmp/app1.sock' , :backlog => 64

pid "#{@path}tmp/pids/unicorn.pid"

stderr_path "#{@path}log/unicorn.stderr.log"
stdout_path "#{@path}log/unicorn.stdout.log"
preload_app true

和我的sinatra应用程序只是一个简单的问候世界,如下:

require "rubygems"
require "sinatra/base"
require "sinatra/reloader" if development?
require "logger"
require "unicorn"

class MainApp < Sinatra::Base
    get '/' do
        "hello world"
    end
end

当我尝试从本地连接到192.168.33.10时,我得到502网关错误。任何提示都会很有帮助哦。感谢。

0 个答案:

没有答案