unicornとnginxを使ってec2インスタンスにデプロイ したいと思っています。
unicornとnginx の起動は確認しているのですが、ブラウザからIPアドレスでwebページにアクセスするとうまく表示されません。 We're sorry, but something went wrong.と出てしまいます。
クローンしたアプリがうまく表示されていないようです。。。
パーミッションは確認済です。pathも合っています
/etc/nginx/conf.d/hoge_app.conf error_log /var/www/rails/hoge_app/log/nginx.error.log; access_log /var/www/rails/hoge_app/log/nginx.access.log; # max body size client_max_body_size 2G; upstream app_server { # for UNIX domain socket setups server unix:/var/www/rails/hoge_app/tmp/sockets/.unicorn.sock fail_timeout=0; } server { listen 80; server_name 18.177.251.97; # nginx so increasing this is generally safe... keepalive_timeout 5; # path for static files root /var/www/rails/hoge_app/public; location = /favicon.ico { access_log off; log_not_found off; } location ~ ^/assets/ { gzip_static on; expires 1d; } # page cache loading location / { try_files $uri/index.html $uri.html $uri @app; } location @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://app_server; } # Rails error pages error_page 404 /404.html; location = /404.html { } error_page 500 502 503 504 /500.html; location = /500.html { root /var/www/rails/hoge_app/public; } }
/etc/nginx/nginx.conf events { worker_connections 1024; } http { 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; tcp_nodelay on; keepalive_timeout 65; types_hash_max_size 2048; include /etc/nginx/mime.types; default_type application/octet-stream; include /etc/nginx/conf.d/*.conf; index index.html index.htm;
/var/www/rails/hoge_app/config/unicorn.conf.rb $worker = 2 $timeout = 30 $app_dir = "/var/www/rails/hoge_app" $listen = File.expand_path 'tmp/sockets/.unicorn.sock', $app_dir $pid = File.expand_path 'tmp/pids/unicorn.pid', $app_dir $std_log = File.expand_path 'log/unicorn.log', $app_dir # set config worker_processes $worker working_directory $app_dir stderr_path $std_log stdout_path $std_log timeout $timeout listen $listen pid $pid # loading booster preload_app true # before starting processes before_fork do |server, worker| defined?(ActiveRecord::Base) and ActiveRecord::Base.connection.disconnect! old_pid = "#{server.config[:pid]}.oldbin" if old_pid != server.pid begin Process.kill "QUIT", File.read(old_pid).to_i rescue Errno::ENOENT, Errno::ESRCH end end end # after finishing processes after_fork do |server, worker| defined?(ActiveRecord::Base) and ActiveRecord::Base.establish_connection end
回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。