こんばんわ。
現在、さくらVPSでnginx + unicorn + capistranoで設定をしております。
独自ドメインで表示するのですが、まっしろな状態で困っております。
設定ファイルは次の通りです。
・nginx
/etc/nginx/site-enabled/my_app.conf(さくらVPS)
upstream unicorn { server unix:/tmp/unicorn.my_app.sock fail_timeout=0; } server { listen 80; server_name www.my_app.com; # Application root, as defined previously root /var/www/app/my_app/current/public; location ^~ /assets/ { gzip_static on; expires max; add_header Cache-Control public; } location ~ ^/(robots.txt|sitemap.xml.gz)/ { root /var/www/app/current/public; } try_files $uri/index.html $uri @unicorn; location @unicorn { proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header Host $http_host; proxy_redirect off; proxy_pass http://unicorn; } error_page 500 502 503 504 /500.html; client_max_body_size 4G; keepalive_timeout 10; }
・unicorn
/config/unicorn/production.rb
root = "/var/www/app/my_app/current" working_directory root pid "#{root}/tmp/pids/unicorn.pid" stderr_path "#{root}/log/unicorn.log" stdout_path "#{root}/log/unicorn.log" worker_processes 4 timeout 30 preload_app true listen '/tmp/unicorn.my_app.sock', backlog: 64 before_fork do |server, worker| Signal.trap 'TERM' do puts 'Unicorn master intercepting TERM and sending myself QUIT instead' Process.kill 'QUIT', Process.pid end defined?(ActiveRecord::Base) and ActiveRecord::Base.connection.disconnect! end after_fork do |server, worker| Signal.trap 'TERM' do puts 'Unicorn worker intercepting TERM and doing nothing. Wait for master to send QUIT' end defined?(ActiveRecord::Base) and ActiveRecord::Base.establish_connection end # Force the bundler gemfile environment variable to # reference the capistrano "current" symlink before_exec do |_| ENV['BUNDLE_GEMFILE'] = File.join(root, 'Gemfile') end
nginxとunicornは無事に動いております。
ps aux | grep nginx
www-data 20842 0.0 0.3 91580 3712 ? S 17:22 0:00 nginx: worker process www-data 20843 0.0 0.3 91580 3712 ? S 17:22 0:00 nginx: worker process www-data 20844 0.0 0.3 91580 3712 ? S 17:22 0:00 nginx: worker process www-data 20845 0.0 0.3 91580 3712 ? S 17:22 0:00 nginx: worker process
ps aux | grep unicorn
hoge 20185 0.1 8.6 307708 88732 ? Sl 16:40 0:03 unicorn master (old) -c /var/www/app/my_app/current/config/unicorn/production.rb -E deployment -D hoge 20213 0.0 8.1 307708 83372 ? Sl 16:40 0:00 unicorn worker[2] -c /var/www/app/my_app/current/config/unicorn/production.rb -E deployment -D hoge 20217 0.0 8.1 307708 83324 ? Sl 16:40 0:00 unicorn worker[1] -c /var/www/app/my_app/current/config/unicorn/production.rb -E deployment -D hoge 20221 0.0 8.1 307708 83372 ? Sl 16:40 0:00 unicorn worker[0] -c /var/www/app/my_app/current/config/unicorn/production.rb -E deployment -D hoge 20224 0.0 8.1 307708 83068 ? Sl 16:40 0:00 unicorn worker[3] -c /var/www/app/my_app/current/config/unicorn/production.rb -E deployment -D hoge 20358 0.1 8.7 307712 89272 ? Sl 16:54 0:03 unicorn master -c /var/www/app/my_app/current/config/unicorn/production.rb -E deployment -D hoge 20364 0.0 8.0 242176 82924 ? Sl 16:54 0:00 unicorn worker[0] -c /var/www/app/my_app/current/config/unicorn/production.rb -E deployment -D hoge 20367 0.0 8.0 242176 82860 ? Sl 16:54 0:00 unicorn worker[1] -c /var/www/app/my_app/current/config/unicorn/production.rb -E deployment -D hoge 20370 0.0 8.1 242176 82992 ? Sl 16:54 0:00 unicorn worker[2] -c /var/www/app/my_app/current/config/unicorn/production.rb -E deployment -D hoge 20372 0.0 8.1 242176 83232 ? Sl 16:54 0:00 unicorn worker[3] -c /var/www/app/my_app/current/config/unicorn/production.rb -E deployment -D hoge 20873 0.0 0.2 12228 2056 pts/8 S+ 17:24 0:00 grep unicorn
pathの問題だと思うのですが、error logに表示されないので・・・
my_app/404.htmlでは、404ページは表示されます。
お手数をおかけしますが、ご教授をお願いします。
回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2016/04/17 09:55
退会済みユーザー
2016/04/17 10:22
2016/04/17 11:40
退会済みユーザー
2016/04/17 12:29
2016/04/17 13:07
2016/04/18 12:38
退会済みユーザー
2016/04/18 12:45