Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/ruby-on-rails-4/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ruby on rails 4 nginx:110:连接超时_Ruby On Rails 4_Nginx_Browser_Browser Cache - Fatal编程技术网

Ruby on rails 4 nginx:110:连接超时

Ruby on rails 4 nginx:110:连接超时,ruby-on-rails-4,nginx,browser,browser-cache,Ruby On Rails 4,Nginx,Browser,Browser Cache,有时,当浏览我的网站时,我收到连接超时错误,并且没有从服务器得到任何响应 我在nginx错误日志文件中的错误如下 *24 client timed out (110: Connection timed out) while waiting for request, client: 182.59.129.85, server: 0.0.0.0:80 #user nobody; worker_processes 1; #error_log logs/error.log; #error_lo

有时,当浏览我的网站时,我收到连接超时错误,并且没有从服务器得到任何响应

我在nginx错误日志文件中的错误如下

*24 client timed out (110: Connection timed out) while waiting for request, client: 182.59.129.85, server: 0.0.0.0:80
#user  nobody;
worker_processes  1;

#error_log  logs/error.log;
#error_log  logs/error.log  notice;
#error_log  logs/error.log  info;
error_log /var/log/nginx-error.log info;

#pid        logs/nginx.pid;


events {
    worker_connections  1024;
}


http {
     passenger_root /home/ubuntu/.rvm/gems/ruby-2.0.0-p598/gems/passenger-5.0.8;
     passenger_ruby /home/ubuntu/.rvm/gems/ruby-2.0.0-p598/wrappers/ruby;

    include       mime.types;
    default_type  application/octet-stream;
#    limit_req_zone $binary_remote_addr zone=one:10m rate=1r/m;
    #log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '
    #                  '$status $body_bytes_sent "$http_referer" '
    #                  '"$http_user_agent" "$http_x_forwarded_for"';

    #access_log  logs/access.log  main;

    sendfile        on;
    #tcp_nopush     on;

    #keepalive_timeout  0;
    keepalive_timeout  65;
#    limit_req_zone $binary_remote_addr zone=one:10m rate=2r/s;

    #gzip  on;

    server {
        listen       80;
        server_name  localhost;
        root /var/www/application/stag-NRB/current/public;
        rails_env staging;
#       limit_req zone=one burst=5;
        #error_log /var/log/nginx/error.log;
        passenger_enabled on;
        client_max_body_size 10000M;
        #charset koi8-r;

        #access_log  logs/host.access.log  main;

        #location / {
           # root   html;
            #index  index.html index.htm;
        #}
          location / {
            #root /var/www/application/JCI-onsptNew/current/public;

            index  index.html index.htm;
 #           limit_req zone=one burst=2 nodelay;
        }

          location /download_apk {
           alias /home/ubuntu;
         }

        #root /var/www/application/JCI-onspotNew/current/public;
        #rails_env production;
        #error_log  /var/log/nginx/nginx_error.log  warn;

        #error_page  404              /404.html;

        # redirect server error pages to the static page /50x.html
        #
        error_page   500 502 503 504  /50x.html;
        location = /50x.html {
            root   html;
        }

        # proxy the PHP scripts to Apache listening on 127.0.0.1:80
        #
        #location ~ \.php$ {
        #    proxy_pass   http://127.0.0.1;
        #}

        }
清除浏览器的缓存后,它会正常工作。但是浏览了一段时间之后,这个问题又回来了

我的nginx配置文件如下

*24 client timed out (110: Connection timed out) while waiting for request, client: 182.59.129.85, server: 0.0.0.0:80
#user  nobody;
worker_processes  1;

#error_log  logs/error.log;
#error_log  logs/error.log  notice;
#error_log  logs/error.log  info;
error_log /var/log/nginx-error.log info;

#pid        logs/nginx.pid;


events {
    worker_connections  1024;
}


http {
     passenger_root /home/ubuntu/.rvm/gems/ruby-2.0.0-p598/gems/passenger-5.0.8;
     passenger_ruby /home/ubuntu/.rvm/gems/ruby-2.0.0-p598/wrappers/ruby;

    include       mime.types;
    default_type  application/octet-stream;
#    limit_req_zone $binary_remote_addr zone=one:10m rate=1r/m;
    #log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '
    #                  '$status $body_bytes_sent "$http_referer" '
    #                  '"$http_user_agent" "$http_x_forwarded_for"';

    #access_log  logs/access.log  main;

    sendfile        on;
    #tcp_nopush     on;

    #keepalive_timeout  0;
    keepalive_timeout  65;
#    limit_req_zone $binary_remote_addr zone=one:10m rate=2r/s;

    #gzip  on;

    server {
        listen       80;
        server_name  localhost;
        root /var/www/application/stag-NRB/current/public;
        rails_env staging;
#       limit_req zone=one burst=5;
        #error_log /var/log/nginx/error.log;
        passenger_enabled on;
        client_max_body_size 10000M;
        #charset koi8-r;

        #access_log  logs/host.access.log  main;

        #location / {
           # root   html;
            #index  index.html index.htm;
        #}
          location / {
            #root /var/www/application/JCI-onsptNew/current/public;

            index  index.html index.htm;
 #           limit_req zone=one burst=2 nodelay;
        }

          location /download_apk {
           alias /home/ubuntu;
         }

        #root /var/www/application/JCI-onspotNew/current/public;
        #rails_env production;
        #error_log  /var/log/nginx/nginx_error.log  warn;

        #error_page  404              /404.html;

        # redirect server error pages to the static page /50x.html
        #
        error_page   500 502 503 504  /50x.html;
        location = /50x.html {
            root   html;
        }

        # proxy the PHP scripts to Apache listening on 127.0.0.1:80
        #
        #location ~ \.php$ {
        #    proxy_pass   http://127.0.0.1;
        #}

        }

nginx如何配置为与后端应用程序通信?请包括nginx配置的相关部分,如消毒服务器/位置块、连接超时设置(如有)等。已添加nginx conf文件供您参考。请参见编辑后的问题。