RailsをAWS EC2サーバー内で同居させようとして詰まっています。
はじめてのことなので基本的なことも理解ができていないかと思います。
下記サイトを参考に進めましたが、うまく行きませんでした。
http://blog.livedoor.jp/no_more_ria10/archives/1060474712.html
$ vi /etc/nginx/conf.d/rails.conf #log_directory # max body size client_max_body_size 2G; upstream webex_server { # for UNIX domain socket setups server unix:/home/kkawahara/workspace/working/webex/tmp/unicorn.sock fail_timeout=0; #app1を自分のアプリケーション名に変更(フォルダ名を変えればこのままでもOK } upstream sample_server { # for UNIX domain socket setups server unix:/home/kkawahara/workspace/working/sample/tmp/unicorn.sock fail_timeout=0; #自分のアプリケーション名に変更 } server { listen 80; server_name test.jp; #取得したドメイン名に変更してください # nginx so increasing this is generally safe... keepalive_timeout 5; # path for static files root /home/kkawahara/workspace/working/webex/public; #自分のアプリケーション名 に変更 # page cache loading try_files $uri/index.html $uri.html $uri @default_app; #ドメイン名のみの場合に飛ばされるデフォルトのアプリを設定(この場合app1) location @default_app { # HTTP headers proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header Host $http_host; proxy_redirect off; proxy_pass http://webex_server; #location = /webex/500.html { #root /home/kkawahara/workspace/working/webex/public; #自分のアプリケーショ>ン名 #} #error_log /home/kkawahara/workspace/working/webex/log/nginx.error.log; #自 分のアプリケーション名に変更 #access_log /home/kkawahara/workspace/working/webex/log/nginx.access.log; #>自分のアプリケーション名に変更 } #end #1つ目のアプリの設定 location /webex { # HTTP headers proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header Host $http_host; proxy_redirect off; proxy_pass http://webex_server/; location = /webex/500.html { root /home/kkawahara/workspace/working/webex/public; #自分のアプリケーション 名 } error_log /home/kkawahara/workspace/working/webex/log/nginx.error.log; #自>分のアプリケーション名に変更 access_log /home/kkawahara/workspace/working/webex/log/nginx.access.log; #自 分のアプリケーション名に変更 } #2つ目のアプリの設定 location /sample { # HTTP headers proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header Host $http_host; proxy_redirect off; proxy_pass http://sample_server/; location = /sample/500.html { root /home/kkawahara/workspace/working/sample/public; #自分のアプリケーショ>ン名 } error_log /home/kkawahara/workspace/working/sample/log/nginx.error.log; #自 分のアプリケーション名に変更 access_log /home/kkawahara/workspace/working/sample/log/nginx.access.log; #>自分のアプリケーション名に変更 } # Rails error pages error_page 500 502 503 504 /500.html; }
###エラー内容
URLにアクセスすると下記表示が出ます。
We're sorry, but something went wrong.
If you are the application owner check the logs for more information.
nginxのエラーログをみると下記内容が書かれていました。
$ sudo vi /var/log/nginx/error.log
2018/10/15 18:55:53 [error] 3375#0: *55 connect() to unix:/home/kkawahara/workspace/working/webex/tmp/unicorn.sock failed (111: Connection refused) while connecting to upstream, client: 209.206.62.15, server: test.jp, request: "POST /events HTTP/1.1", upstream: "http://unix:/home/kkawahara/workspace/working/webex/tmp/unicorn.sock:/events", host: "test.jp"
また参考サイトにはrailsの起動の記載がなかったのですが、bunde exec rails s で起動はどのディレクトリですればいいのでしょうか?
もしくはデーモンにしておく必要があるのでしょうか?
どうかお力を貸して頂きたいです
よろしくお願いします
###各バージョン
nginx version: nginx/1.12.1
unicorn v5.4.1
Rails 5.2.1
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。