皆様
ご覧頂きありがとうございます。
初めて質問させて頂きます。
まだプログラミングを始めたばかりで、表現に間違いがあるかもしれませんが、
その際はご指摘頂けますと幸いです。
宜しくお願い致します。
###実現したいこと
当該IPアドレスを入力した時にアプリの画面表示
###エラーメッセージ
白いページに Not Found: /
###環境/前提
・ さくらVPS / CentOS 6.8 / rails 4.2.6 / Nginx 1.10.1 / Capistrano3/
・ Unicorn は bundle exec unicorn_rails -c config/unicorn.rb -D -E staging で起動確認済み
/etc/nginx/conf.d/local.conf(default.conf)
upstream unicorn{ server unix:/tmp/unicorn.sock fail_timeout=0; } server { listen (IPアドレス):8080; listen 80; server_name (自分で決めたホスト名); root /var/www/my_app/current/public; client_max_body_size 4G; location ~ ^/assets/ { root /var/www/my_app/current/public; } location / { root /var/www/my_app/current/public; 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_redirect off; autoindex on; if (!-f $request_filename) { proxy_pass http://unicorn; break; } } error_page 500 502 503 504 /500.html; location = /500.html { root /var/www/my_app/current/public; } }
Unicorn.rb
@app_path = '/var/www/my_app' working_directory @app_path + "/current" worker_processes 2 preload_app true timeout 30 listen "/tmp/unicorn.sock", :backlog => 64 pid "/var/www/my_app/shared/tmp/pids/unicorn.pid" stderr_path "/var/www/my_app/shared/log/unicorn.stderr.log" stdout_path "/var/www/my_app/shared/log/unicorn.stdout.log" before_fork do |server, worker| ENV['BUNDLE_GEMFILE'] = File.expand_path('Gemfile', ENV['RAILS_ROOT']) end before_fork do |server, worker| if defined?(ActiveRecord::Base) ActiveRecord::Base.connection.disconnect! end old_pid = "#{server.config[:pid]}.oldbin" if File.exists?(old_pid) && server.pid != old_pid begin Process.kill("QUIT", File.read(old_pid).to_i) rescue Errno::ENOENT, Errno::ESRCH end end end after_fork do |server, worker| if defined?(ActiveRecord::Base) ActiveRecord::Base.establish_connection end end
###試したこと
・Unicon停止した状態で、IPアドレスに接続を図る
└ Rails の We're sorry, but something went wrong. が表示
└ to unix:/tmp/unicorn.sock failed to unix:/tmp/unicorn.sock failed (111: Connection refused)
・Unicorn 起動
└ 白い画面にNot Found: /
└ エラーログなし

回答2件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2016/10/22 06:03
2016/10/22 09:14
2016/10/22 09:16 編集
2016/10/22 09:19
2016/10/22 09:29
2016/10/22 09:32
2016/10/22 10:08
2016/10/22 11:21 編集
2016/10/22 11:27
2016/10/22 13:41
2016/10/22 13:53
2016/10/25 09:19