nginx 网站速度特别慢,但仅限于我的网络

nginx 网站速度特别慢,但仅限于我的网络

我的个人网站对于我和我的网络来说速度非常慢。如果我通过手机上的蜂窝数据或另一栋楼的笔记本电脑连接到它,它和其他任何网站一样快,但是当我从连接到运行该网站的网络的任何设备连接时,加载任何页面需要 0.3 秒(正常时间)到 3 分钟以上,但 0.3 秒的加载时间每个会话只发生一次。有时它根本无法加载,只是超时。

我的 nginx.conf 如下所示:

# nginx.conf

worker_processes 5;
error_log logs/error.log;
pid       logs/nginx.pid;
worker_rlimit_nofile 8192;

events {
    worker_connections  4096;
    use poll;
    accept_mutex on;
    multi_accept on;
}


http {
    sendfile on;
    tcp_nopush on;
    tcp_nodelay on;
    include mime.types;
    access_log  logs/access.log;
    keepalive_timeout 75s;
    keepalive_requests 100000;
    server_names_hash_bucket_size 128; # this seems to be required for some vhosts
    client_max_body_size 100k;
    proxy_read_timeout 1;
    proxy_buffering off;
    ssl_session_cache   shared:SSL:10m;
    ssl_session_timeout 10m;
    
    ssl_protocols TLSv1 TLSv1.1 TLSv1.2; # Dropping SSLv3, ref: POODLE
    ssl_prefer_server_ciphers on;

    upstream files {
        zone upstreams 64K;
        server 127.0.0.1:2025 max_fails=1 fail_timeout=5s;
        keepalive 2;
    }

    server {
    
        #listen 80;
    
        listen 443 ssl;
        ssl_certificate C:/Certbot/live/website.gov/fullchain.pem;
        ssl_certificate_key C:/Certbot/live/website.gov/privkey.pem;
        
        server_name website.gov;
        
    
        location /fs/ {
            proxy_set_header Host $host;
            proxy_set_header X-Real-IP $remote_addr;
            proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
            proxy_set_header X-Forwarded-Proto $scheme;
            proxy_pass http://localhost:3000/;
        }
        
        location /files/ {
            proxy_set_header Host $host;
            proxy_set_header X-Real-IP $remote_addr;
            proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
            proxy_set_header X-Forwarded-Proto $scheme;
            proxy_pass http://files/;
        }
    
        location / {
            root html;
        }
        
        location /e/ {
            add_header Content-Type text/plain;
            return 200 $remote_addr;
        }
        
        location /movies/ {
            alias E:/movies/;
            autoindex on; #Show table of contents
            autoindex_exact_size off; #Show file size
            autoindex_localtime on; #Show file time
        }
        
        location /music/ {
            alias E:/memes_and_dumb_garbage/private/music/;
            autoindex on; #Show table of contents
            autoindex_exact_size off; #Show file size
            autoindex_localtime on; #Show file time
        }
        
    }
    
    error_page   500 502 503 504  /50x.html;
}

大多数这些指令都是由论坛提供的,因为这个问题已经持续了好几个月了。我已经研究过它们,但我真的不太了解它们的重要性,也不太了解它们适合什么规模,例如像我这样的访问者很少的小型网站,像 superuser.com 这样的中等规模的网站,或者像 google.com 这样的大型网站

任何帮助都将不胜感激。谢谢(已编辑以删除私人信息)

相关内容