nginx对静态文件的响应非常慢

nginx对静态文件的响应非常慢,nginx,Nginx,在试图了解为什么我的网站有时速度慢时,我记录了响应时间。刚才看到,即使是静态文件,我的服务器有时也会在10秒以上做出响应。似乎与cpu负载没有任何联系:cpu从不超过15-20%。从日志中,我提取了需要很长时间的请求(时间以xx.xxx格式结束): 我的nginx配置非常基本: user www-data; worker_processes 4; pid /run/nginx.pid; events { worker_connections 768; # multi_accep

在试图了解为什么我的网站有时速度慢时,我记录了响应时间。刚才看到,即使是静态文件,我的服务器有时也会在10秒以上做出响应。似乎与cpu负载没有任何联系:cpu从不超过15-20%。从日志中,我提取了需要很长时间的请求(时间以xx.xxx格式结束):

我的nginx配置非常基本:

user www-data;
worker_processes 4;
pid /run/nginx.pid;

events {
    worker_connections 768;
    # multi_accept on;
}

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;

    ##
    # Logging Settings
    ##

    log_format timed_combined '$remote_addr - $remote_user [$time_local] '
    '"$request" $status $body_bytes_sent '
    '"$http_referer" "$http_user_agent" '
    '$request_time $upstream_response_time $pipe';

    access_log /var/log/nginx/access.log timed_combined;
    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;

    ##
    # 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/*;
}

我想不出问题出在哪里:(

我不得不完全放弃VPS。 我在一个全新的VPS上安装了所有东西,一切都很好


我仍然不知道问题出在哪里,但由于新服务器上没有出现问题,我不在乎问题出在哪里。

我不得不完全放弃VPS。 我在一个全新的VPS上安装了所有东西,一切都很好


我仍然不知道问题出在哪里,但因为它没有发生在新服务器上,所以我不关心它是什么。

网络连接速度慢?不是根据我的VPS所在的人说的。他们声称连接非常好。我想这可能是拒绝服务攻击,但我在日志中找不到任何东西。网络连接速度慢?不是根据我的VPS所在的人说的。他们声称连接非常好。我想这可能是拒绝服务攻击,但我在日志中找不到任何东西。
user www-data;
worker_processes 4;
pid /run/nginx.pid;

events {
    worker_connections 768;
    # multi_accept on;
}

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;

    ##
    # Logging Settings
    ##

    log_format timed_combined '$remote_addr - $remote_user [$time_local] '
    '"$request" $status $body_bytes_sent '
    '"$http_referer" "$http_user_agent" '
    '$request_time $upstream_response_time $pipe';

    access_log /var/log/nginx/access.log timed_combined;
    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;

    ##
    # 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/*;
}