caches_page works in development and not in production. In production it creates the cache but rewrites at each access
AppRuby::Application.configure do
# Settings specified here will take precedence over those in config/application.rb
# Code is not reloaded between requests
config.cache_classes = true
# Full error reports are disabled and caching is turned on
config.consider_all_requests_local = false
config.action_controller.perform_caching = true
# Disable Rails's static asset server (Apache or nginx will already do this)
config.serve_static_assets = false
# Compress JavaScripts and CSS
config.assets.compress = true
# Don't fallback to assets pipeline if a precompiled asset is missed
config.assets.compile = true
# Generate digests for assets URLs
config.assets.digest = true
# Enable locale fallbacks for I18n (makes lookups for any locale fall back to
# the I18n.default_locale when a translation can not be found)
config.i18n.fallbacks = true
# Send deprecation notices to registered listeners
config.active_support.deprecation = :notify
end
my web server is nginx.
My nginx.conf
user www-data;
worker_processes 16;
pid /var/run/nginx.pid;
worker_rlimit_nofile 10000;
events {
worker_connections 8000;
# multi_accept on;
}
http {
include /etc/nginx/mime.types;
default_type application/octet-stream;
charset utf-8;
#log
access_log off;
error_log /var/log/nginx/error.log;
sendfile on;
#Queremos enviar todos os cabeçalhos de resposta em um pacote. Isso permite que um cliente para começar a renderização de conteúdo imediatamente após o primeiro pacote chega
tcp_nopush on;
#Enviar pequenos pedaços de dados imediatamente
tcp_nodelay on;
#Tempo antes de solicitar nova pagina
keepalive_timeout 30;
#tempo limite para esperar dados do cliente
client_body_timeout 10;
client_header_timeout 10;
#Diminuir os requisitos de memória para armazenamento de cabeçalhos de solicitação (o padrão é 1024 bytes):
client_header_buffer_size 128;
# tamanho maximo de upload de arquivo
client_max_body_size 10m;
types_hash_max_size 2048;
server_names_hash_bucket_size 64;
#server_tokens off;
##
# Gzip Settings
##
gzip on;
gzip_http_version 1.1;
#permite ou n a compressao da resposta para solicitacao proxy
gzip_proxied any;
#comprimento minimo da resposta a ser compactada(em bytes)
gzip_min_length 500;
#Desabilita a compressao se bater com a expressao abaixo
gzip_disable "MSIE [1-6]\.";
#permite a compressao desses tipos MIME
gzip_types text/plain text/css application/json application/x-javascript text/xml application/xml application/xml+rss text/javascript;
#nivel de compressao de 1 a 9
gzip_comp_level 4;
##
# nginx-naxsi config
##
# Uncomment it if you installed nginx-naxsi
##
#include /etc/nginx/naxsi_core.rules;
##
# nginx-passenger config
##
# Uncomment it if you installed nginx-passenger
##
#passenger_root /usr;
#passenger_ruby /usr/bin/ruby;
##
# Virtual Host Configs
##
include /etc/nginx/conf.d/*.conf;
include /etc/nginx/sites-enabled/*;
And my file in sites-avaliable
upstream unicorn_app.com {
#server unix:/home/ubuntu/www/ruby/app.com/current/tmp/.sock
server unix:/home/ubuntu/www/ruby/app.com/current/tmp/sockets/unicorn.sock fail_timeout=0;
}
server {
listen 80;
server_name subdominio.mydominio.com;
root /home/ubuntu/www/ruby/app.com/current/public;
#error_page 500 502 503 504 /50x.html;
location = /50x.html {
#root /usr/share/nginx/www;
root /home/ubuntu/www/ruby/app.com/current/public;
}
location / {
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
proxy_redirect off;
#proxy_pass http://unicorn_server_app;
if (!-f $request_filename) {
proxy_pass http://unicorn_app.com;
break;
}
}
}