nginxとunicornを下記のように設定し
$service nginx restart
$bundle exec unicorn -c unicorn.rb -D
と、上記起動コマンドも成功しています。
しかし、domainにアクセスしてもずっと接続中なり、結果タイムアウトになります。
nginxのエラーログも吐き出していないので原因もわかりません。
これはなにが原因なのでしょうか?
もう何時間もここにハマってしまっているのでお力を貸して頂きたいです。
/etc/nginx/nginx.conf # For more information on configuration, see: # * Official English Documentation: http://nginx.org/en/docs/ # * Official Russian Documentation: http://nginx.org/ru/docs/ user kkawahara; #appusr; worker_processes 2; error_log /var/log/nginx/error.log; pid /var/run/nginx.pid; events { worker_connections 1024; } http { upstream unicorn_server { server unix:/home/hoge/app/meraki_scanning_api/tmp/unicorn.sock; } include /etc/nginx/mime.types; default_type application/octet-stream; log_format main '$remote_addr - $remote_user [$time_local] "$request" ' '$status $body_bytes_sent "$http_referer" ' '"$http_user_agent" "$http_x_forwarded_for"'; access_log /var/log/nginx/access.log main; sendfile on; #tcp_nopush on; #keepalive_timeout 0; #gzip on; # Load modular configuration files from the /etc/nginx/conf.d directory. # See http://nginx.org/en/docs/ngx_core_module.html#include # for more information. include /etc/nginx/conf.d/*.conf; index index.html index.htm; server { listen 80; server_name ホスト名; root /home/hoge/app/meraki_scanning_api/public; #charset koi8-r; access_log /var/log/nginx/scan.access.log main; error_log /var/log/nginx/scan.error.log; location / { # if static files don't exist, proxy it to Unicorn. if ( !-f $request_filename) { proxy_pass http://unicorn_server; } } # redirect server error pages to the static page /40x.html # error_page 404 /404.html; location = /40x.html { } # redirect server error pages to the static page /50x.html # error_page 500 502 503 504 /50x.html; location = /50x.html { } } }
./unicorn.rb require 'rubygems' require 'sinatra' require './meraki_scannin_api.rb' @dir = "/home/hoge/app/meraki_scanning_api/" worker_processes 4 working_directory @dir timeout 300 listen "/home/hoge/app/meraki_scanning_api/tmp/unicorn.sock" # pid file pid "./tmp/pids/unicorn.pid" # logs stderr_path "#{@dir}log/unicorn.stderr.log" stdout_path "#{@dir}log/unicorn.stdout.log"
unicorn.stderr.logを確認したところ
unicorn起動時に下記ログが出ていました
最初に unlinking exisitingとありますが、調べるとこれは問題ではないようです。
となると、何が原因か本当に検討つきません。
アドバイス頂けると幸いです。
I, [2018-11-13T14:38:29.134935 #31769] INFO -- : unlinking existing socket=/home/hmizuno/app/meraki_scanning_api/tmp/unicorn.sock I, [2018-11-13T14:38:29.135278 #31769] INFO -- : listening on addr=/home/hmizuno/app/meraki_scanning_api/tmp/unicorn.sock fd=10 I, [2018-11-13T14:38:29.135449 #31769] INFO -- : worker=0 spawning... I, [2018-11-13T14:38:29.136199 #31769] INFO -- : worker=1 spawning... I, [2018-11-13T14:38:29.136764 #31769] INFO -- : worker=2 spawning... I, [2018-11-13T14:38:29.137368 #31772] INFO -- : worker=0 spawned pid=31772 I, [2018-11-13T14:38:29.137701 #31772] INFO -- : Refreshing Gem list I, [2018-11-13T14:38:29.138271 #31769] INFO -- : worker=3 spawning... I, [2018-11-13T14:38:29.140363 #31774] INFO -- : worker=1 spawned pid=31774 I, [2018-11-13T14:38:29.141043 #31769] INFO -- : master process ready I, [2018-11-13T14:38:29.146175 #31774] INFO -- : Refreshing Gem list I, [2018-11-13T14:38:29.146733 #31777] INFO -- : worker=2 spawned pid=31777 I, [2018-11-13T14:38:29.146967 #31777] INFO -- : Refreshing Gem list I, [2018-11-13T14:38:29.156287 #31780] INFO -- : worker=3 spawned pid=31780 I, [2018-11-13T14:38:29.156561 #31780] INFO -- : Refreshing Gem list I, [2018-11-13T14:38:29.197877 #31774] INFO -- : worker=1 ready I, [2018-11-13T14:38:29.198191 #31772] INFO -- : worker=0 ready I, [2018-11-13T14:38:29.200622 #31777] INFO -- : worker=2 ready I, [2018-11-13T14:38:29.201547 #31780] INFO -- : worker=3 ready
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。