2
我的實例有3.5GB內存和超過970MB是免費的。我的Rails應用程序在第一次啓動時非常慢。我需要重新啓動nginx。任何建議?我的配置有問題嗎?Rails應用程序與乘客+ nginx非常緩慢
這是我爲乘客配置+ nginx的
user user;
worker_processes 2;
pid /run/nginx.pid;
events {
worker_connections 10240;
}
worker_rlimit_nofile 20000;
http {
##
# Basic Settings
##
sendfile on;
tcp_nopush on;
tcp_nodelay on;
keepalive_timeout 65;
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;
client_body_buffer_size 10K;
client_header_buffer_size 1k;
client_max_body_size 900m;
large_client_header_buffers 2 1k;
##
# Logging Settings
##
access_log /var/log/nginx/access.log;
error_log /var/log/nginx/error.log;
##
# Gzip Settings
##
gzip on;
gzip_disable "msie6";
# gzip_vary on;
# gzip_proxied any;
# gzip_comp_level 6;
# gzip_buffers 16 8k;
# gzip_http_version 1.1;
# gzip_types text/plain text/css application/json application/x-javascript text/xml application/xml application/xml+rss text/javascript;
##
# Phusion Passenger config
##
# Uncomment it if you installed passenger or passenger-enterprise
##
passenger_root /usr/lib/ruby/vendor_ruby/phusion_passenger/locations.ini;
passenger_ruby /home/azureuser/.rvm/wrappers/ruby-2.1.1/ruby;
passenger_log_level 2;
passenger_debug_log_file /var/log/nginx/passenger-error.log;
passenger_spawn_method smart;
passenger_pool_idle_time 1000;
passenger_max_preloader_idle_time 0;
passenger_max_requests 5000;
passenger_pre_start http://api.mytjacket.com;
##
# Virtual Host Configs
##
server {
listen 80;
server_name localhost;
root /home/user/apps/project-name/current/public;
passenger_enabled on;
proxy_buffers 8 16k;
proxy_buffer_size 32k;
passenger_buffers 8 16k;
passenger_buffer_size 32k;
location /websocket {
proxy_pass http://localhost:port/websocket;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
}
}
}