I just successfully configured ssl on my rails app on the production server, but now, when I try to access the site I got "We're sorry, but something went wrong." error:
If I disable ssl by not using any ssl setting, my Rails app will run just fine. It's only when I use the ssl setting, that I will have this problem. Which suggest that there is nothing wrong with my Rails code or something.
I already checked these logs files : "production.log puma.access.log puma.error.log" but there are nothing there except for :
=== puma startup: 2017-02-08 21:18:32 +0000 ===
* Listening on unix:///home/deploy/apps/my_app/shared/tmp/sockets/my_app-puma.sock
And below is my nginx.conf setting:
upstream myapp_puma {
#server unix:/tmp/myapp_puma.sock fail_timeout=0;
server unix:///home/deploy/apps/my_app/shared/tmp/sockets/puma.sock;
}
# for redirecting to https version of the site
server {
listen 80;
rewrite ^(.*) https://$host$1 permanent;
}
# for redirecting to non-www version of the site
server {
listen 80;
server_name my.my_app.com;
rewrite ^(.*) http://my.my_app.com$1 permanent;
}
server {
listen 443 default ssl;
server_name my.my_app.com;
root /home/deploy/apps/my_app/current/public;
access_log /home/deploy/apps/my_app/current/log/nginx.access.log;
error_log /home/deploy/apps/my_app/current/log/nginx.error.log info;
ssl on;
ssl_certificate /etc/letsencrypt/live/my.my_app.com/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/my.my_app.com/privkey.pem;
ssl_session_timeout 5m;
ssl_protocols SSLv2 SSLv3 TLSv1;
ssl_ciphers HIGH:!aNULL:!MD5;
ssl_prefer_server_ciphers on;
location ^~ /assets/ {
gzip_static on;
expires max;
add_header Cache-Control public;
}
try_files $uri/index.html $uri @myapp_puma;
location @myapp_puma {
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-Proto https;
proxy_redirect off;
proxy_pass http://myapp_puma;
}
error_page 500 502 503 504 /500.html;
client_max_body_size 4G;
keepalive_timeout 10;
}
来源:https://stackoverflow.com/questions/42124054/were-sorry-but-something-went-wrong-rails-nginx-puma-digitalocean