ruby 2.1.3
Rails 4.2.3
ローカルでのPCはmac
sakuraはVPSのcentos
nginx1.8.0
unicorn
現在nginxとunicornを使い複数のサイト立ち上げを行っているのですが、うまくいきません。
以下何か気になる点御座いませんでしょうか?
nginxの設定
/etc/nginx/nginx.conf
worker_processes 1; events { worker_connections 1024; } http { upstream unicornapp { server unix:tmp/sockets/unicorn.sock; } server { listen 80; server_name localhost; location / { proxy_pass http://unicornapp; } } }
/etc/nginx/conf.d/default.conf
# サイトA用の設定 upstream unicorn_server { server unix:tmp/sockets/unicorn.sock; } server { listen 80; server_name siteA.com; root /home/hogehoge/siteA/public; try_files $uri/index.html $uri @unicorn; location @unicorn { 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_pass http://unicorn_server; } } # siteB用 upstream unicorn_server_b { server unix:tmp/sockets/unicorn.sock; } server { listen 80; server_name siteb.com; root /home/hogehoge/siteb/public; try_files $uri/index.html $uri @unicorn; location @unicorn { 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_pass http://unicorn_server_b; } }
/etc/nginx/nginx.conf
/etc/nginx/conf.d/default.conf
のserver unix:tmp/sockets/unicorn.sock;は同じにしております。
siteAとsiteBのunicorn設定
production: worker_processes: 16 listen: "unix:tmp/sockets/unicorn.sock"
unicornのlogを確認していますがエラーは御座いません。
ですがブラウザの表示は
502 Bad Gateway
nginx/1.8.0
となります。
↑この状態はnginxが立ち上がっているがアプリとの連携がうまくいっていな状態なのかなーと。。。
ここを確認すると良いなど御座いましたら宜しくお願いします。
あなたの回答
tips
プレビュー