Digital Ocean Serverで私のレールアプリにアクセスしようとすると、ブラウザに次のエラーが表示されます。コンソール:net :: ERR_TOO_MANY_REDIRECTSNginx、Unicorn、net :: ERR_TOO_MANY_REDIRECTS
この時点で、capistranoはエラーなく正常に展開されます。このアプリはローカルで完璧に動作します(エラーはありません)。
以下は、nginx、unicorn、およびrailsのエラーログファイルから始まるその他の関連ファイルで、nginxおよびunicornの設定ファイルも示しています。 /var/log/nginx/error.log
の/ etc /デフォルト/ユニコーン
CONFIGURED=yes
TIMEOUT=60
APP_ROOT=/home/rails/rails_project/current
CONFIG_RB=/etc/unicorn.conf
PID=/var/run/unicorn.pid
RAILS_ENV="production"
UNICORN_OPTS="-D -c $CONFIG_RB -E $RAILS_ENV"
PATH=/home/rails/.rvm/gems/ruby-2.2.2/bin:/home/rails/.rvm/gems/[email protected]/bin$
export GEM_HOME=/home/rails/.rvm/gems/ruby-2.2.2
export GEM_PATH=/home/rails/.rvm/gems/ruby-2.2.2:/home/rails/.rvm/gems/[email protected]$
export HOME=/home/rails
DAEMON=/home/rails/.rvm/gems/ruby-2.2.2/bin/unicorn
/var/log/unicorn/unicorn.log
I, [2016-05-13T22:26:59.271424 #11584] INFO -- : reaped #<Process::Status: pid 11587 exit 0> worker=0
I, [2016-05-13T22:26:59.272911 #11584] INFO -- : reaped #<Process::Status: pid 11590 exit 0> worker=1
I, [2016-05-13T22:26:59.273219 #11584] INFO -- : reaped #<Process::Status: pid 11592 exit 0> worker=2
I, [2016-05-13T22:26:59.273573 #11584] INFO -- : reaped #<Process::Status: pid 11595 exit 0> worker=3
I, [2016-05-13T22:26:59.274209 #11584] INFO -- : master complete
I, [2016-05-13T22:27:00.664033 #12489] INFO -- : unlinking existing socket=/var/run/unicorn.sock
I, [2016-05-13T22:27:00.664570 #12489] INFO -- : listening on addr=/var/run/unicorn.sock fd=10
I, [2016-05-13T22:27:00.668023 #12489] INFO -- : worker=0 spawning...
I, [2016-05-13T22:27:00.669161 #12489] INFO -- : worker=1 spawning...
I, [2016-05-13T22:27:00.670383 #12492] INFO -- : worker=0 spawned pid=12492
I, [2016-05-13T22:27:00.671245 #12489] INFO -- : worker=2 spawning...
I, [2016-05-13T22:27:00.676617 #12489] INFO -- : worker=3 spawning...
I, [2016-05-13T22:27:00.680864 #12495] INFO -- : worker=1 spawned pid=12495
I, [2016-05-13T22:27:00.681924 #12489] INFO -- : master process ready
I, [2016-05-13T22:27:00.689107 #12497] INFO -- : worker=2 spawned pid=12497
I, [2016-05-13T22:27:00.696755 #12500] INFO -- : worker=3 spawned pid=12500
I, [2016-05-13T22:27:00.802486 #12492] INFO -- : Refreshing Gem list
I, [2016-05-13T22:27:00.804209 #12500] INFO -- : Refreshing Gem list
I, [2016-05-13T22:27:00.807876 #12497] INFO -- : Refreshing Gem list
I, [2016-05-13T22:27:00.811879 #12495] INFO -- : Refreshing Gem list
I, [2016-05-13T22:27:10.403242 #12500] INFO -- : worker=3 ready
I, [2016-05-13T22:27:10.404469 #12497] INFO -- : worker=2 ready
I, [2016-05-13T22:27:10.406947 #12495] INFO -- : worker=1 ready
I, [2016-05-13T22:27:10.407474 #12492] INFO -- : worker=0 ready
2016/05/13 21:00:18 [error] 31654#0: *1 upstream timed out (110: Connection timed out) while reading response header from upstream, client: 148.75.53.23, server: codepajamas.com, request: "GET/HTTP/1.1", upstream: "http://unix:/var/run/unicorn.sock/", host: "codepajamas.com"
2016/05/13 21:05:33 [error] 31654#0: *5 upstream timed out (110: Connection timed out) while reading response header from upstream, client: 148.75.53.23, server: codepajamas.com, request: "GET/HTTP/1.1", upstream: "http://unix:/var/run/unicorn.sock/", host: "codepajamas.com"
2016/05/13 21:19:52 [error] 31654#0: *8 upstream timed out (110: Connection timed out) while reading response header from upstream, client: 180.76.15.29, server: codepajamas.com, request: "GET/HTTP/1.1", upstream: "http://unix:/var/run/unicorn.sock/", host: "www.codepajamas.com"
2016/05/13 21:21:40 [error] 31654#0: *12 upstream timed out (110: Connection timed out) while reading response header from upstream, client: 148.75.53.23, server: codepajamas.com, request: "GET/HTTP/1.1", upstream: "http://unix:/var/run/unicorn.sock/", host: "codepajamas.com"
2016/05/13 21:30:33 [error] 31654#0: *16 upstream timed out (110: Connection timed out) while reading response header from upstream, client: 148.75.53.23, server: codepajamas.com, request: "GET/HTTP/1.1", upstream: "http://unix:/var/run/unicorn.sock/", host: "codepajamas.com"
/home/rails/rails_project/current/log/production.log
(empty)
listen "unix:/var/run/unicorn.sock"
worker_processes 4
user "rails"
working_directory "/home/rails/rails_project/current"
pid "/var/run/unicorn.pid"
stderr_path "/var/log/unicorn/unicorn.log"
stdout_path "/var/log/unicorn/unicorn.log"
/etc/nginx/nginx.conf /etc/unicorn.conf
user www-data;
worker_processes 4;
pid /run/nginx.pid;
events {
worker_connections 768;
}
http {
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;
access_log /var/log/nginx/access.log;
error_log /var/log/nginx/error.log;
gzip on;
gzip_disable "msie6";
text/xml application/xml application/xml+rss text/javascript;
include /etc/nginx/conf.d/*.conf;
include /etc/nginx/sites-enabled/*;
}
/etc/nginx/sites-有効/無効
upstream app_server {
server unix:/var/run/unicorn.sock fail_timeout=0;
}
server {
listen 443 ssl;
server_name <mydomain>.com www.<mydomain>.com;
ssl_certificate /etc/letsencrypt/live/<mydomain>.com/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/<mydomain>.com/privkey.pem;
root /home/rails/rails_project/current/public;
index index.htm index.html;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_prefer_server_ciphers on;
ssl_dhparam /etc/ssl/certs/dhparam.pem;
ssl_ciphers <removed don't want you to see>
ssl_session_timeout 1d;
ssl_session_cache shared:SSL:50m;
ssl_stapling on;
ssl_stapling_verify on;
add_header Strict-Transport-Security max-age=15768000;
location/{
try_files $uri/index.html $uri.html $uri @app;
}
location ~* ^.+\. (jpg|jpeg|gif|png|ico|zip|tgz|gz|rar|bz2|doc|xls|exe|pdf|ppt|txt|tar|mid|midi|wav|bmp|rtf|mp3|flv|mpeg|avi)$ {
try_files $uri @app;
}
location @app {
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;
}
location ~ /.well-known {
allow all;
root /usr/share/nginx/html;
}
}
server {
# redirect HTTP to HTTPS
listen 80;
server_name <mydomain>.com www.<mydomain>.com;
return 301 https://$host$request_uri;
}
何か助けてください。