色々と調べていると問題はunicornかnginxのファイルの記述の仕方にあると思うのですが、どうやって書き換えればいいのか知識がないためずっと進展がない状態です。
unicorn.conf.rbのファイルは
# set lets $worker = 2 $timeout = 30 $app_dir = "/var/www/rails/Triplor" #自分のアプリケーション名 $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|
そして/etc/nginx/conf.d/Triplor.confの中身は
# log directory error_log /var/www/rails/Triplor/log/nginx.error.log; access_log /var/www/rails/Triplor/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/Triplor/tmp/sockets/.unicorn.sock fail_timeout=0; } server { listen 80; server_name 52.69.43.128; # nginx so increasing this is generally safe... keepalive_timeout 5; # path for static files root /var/www/rails/Triplor; # page cache loading 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 500 502 503 504 /500.html; location = /500.html { root /var/www/rails/Triplor; } }
誰か解決策を教えてもらえたらありがたいです!
回答2件
あなたの回答
tips
プレビュー