Ruby on rails Rails 4.2应用程序没有';在虚拟专用服务器上空闲2-3小时后无法响应
我正在尝试在upcloud上设置我的虚拟专用服务器。我正在使用PUMA4.3和ruby 2.4.2以及rails 4.2.8。我的彪马配置是Ruby on rails Rails 4.2应用程序没有';在虚拟专用服务器上空闲2-3小时后无法响应,ruby-on-rails,ruby,ruby-on-rails-4,puma,Ruby On Rails,Ruby,Ruby On Rails 4,Puma,我正在尝试在upcloud上设置我的虚拟专用服务器。我正在使用PUMA4.3和ruby 2.4.2以及rails 4.2.8。我的彪马配置是 threads_count = Integer(ENV['RAILS_MAX_THREADS'] || 5) threads threads_count, threads_count preload_app! rackup DefaultRackup port ENV['PORT'] || 3000 environmen
threads_count = Integer(ENV['RAILS_MAX_THREADS'] || 5)
threads threads_count, threads_count
preload_app!
rackup DefaultRackup
port ENV['PORT'] || 3000
environment ENV['RACK_ENV'] || 'development'
on_worker_boot do
# Worker specific setup for Rails 4.1+
# See: https://devcenter.heroku.com/articles/deploying-rails-applications-with-the-puma-web-server#on-worker-boot
ActiveRecord::Base.establish_connection
end
我的Nginx配置是
worker_connections 768;
# multi_accept on;
}
http {
##
# Basic Settings
##
sendfile on;
tcp_nopush on;
tcp_nodelay on;
keepalive_timeout 36000s;
types_hash_max_size 2048;
# server_tokens off;
# server_names_hash_bucket_size 64;
# server_name_in_redirect off;
include /etc/nginx/mime.types;
default_type application/octet-stream;
##
# SSL Settings
##
ssl_protocols TLSv1 TLSv1.1 TLSv1.2; # Dropping SSLv3, ref: POODLE
ssl_prefer_server_ciphers on;
最后,我的example.com.conf文件是
upstream my_app {
server unix:///var/run/my_app.sock;
}
server {
listen 80;
server_name 94.237.52.251:443; # change to match your URL
root /soop/soup; # I assume your app is located at that location
location / {
proxy_pass http://94.237.52.251:443; # match the name of upstream directive which is defined above
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
location ~* ^/assets/ {
# Per RFC2616 - 1 year maximum expiry
expires 1y;
add_header Cache-Control public;
# Some browsers still send conditional-GET requests if there's a
# Last-Modified header or an ETag header even if they haven't
# reached the expiry date sent in the Expires header.
add_header Last-Modified "";
add_header ETag "";
break;
}
}
我必须在每15-20分钟的空闲时间后重新启动rails服务器,或者每次从VPS断开连接后重新启动rails服务器,否则,浏览器会显示这两种情况
94.237.52.251响应时间过长。
或
当前无法处理此请求。HTTP错误500
我现在要面对这个问题一个星期了。请帮帮我。更改您的
保持生命超时36000秒代码>至75秒更改您的保持有效时间超时36000秒
到75s如果您看到错误500,请等待一分钟左右,然后再试一次,您是否仍然收到此错误?我已经尝试了很多次,等待了几分钟,但没有得到修复。我每次都必须重新启动服务器。如果您看到错误500,请稍等一分钟左右,然后再试一次,您是否仍然会遇到此错误?我已经尝试了很多次,等待了几分钟,但没有得到修复。每次我都必须重新启动服务器。