为什么我的 VPS 通过 https 和 ftp 下载同一个文件带宽差别这么大

为什么我的 VPS 通过 https 和 ftp 下载同一个文件带宽差别这么大

版本:

  • Ubuntu 16.04 amd64
  • nginx 1.14
  • vsftpd 3.0.3

我通过dd位于主 ftp 用户目录中的 .File 创建了 1GB 的文件。

我创建了到文件的符号链接:[ftp dir] -> [/var/www/nginx/html] ( ln -s $SRC/1GB.test $DEST/1GB.test)

因此,我可以通过以下方式下载文件:

现在我从家里的路由器下载文件(带宽50mbit/s):

wget ftp://yshinkarev.ru/1GB.test -O /dev/null
(5.50 MB/s) - '/dev/null' saved [1073741824]

wget https://yshinkarev.ru/1GB.test -O /dev/null
(2.22 MB/s) - '/dev/null' saved [1073741824/1073741824]

为何差异这么大?

我的 vsftpd.conf:

listen=NO
listen_ipv6=YES
local_enable=YES
local_root=/home
write_enable=YES
local_umask=0000
chroot_local_user=YES
anonymous_enable=YES
anon_upload_enable=YES
anon_mkdir_write_enable=YES
anon_root=/shares/ftp
anon_umask=0000
file_open_mode=0666
dirmessage_enable=YES
use_localtime=YES
connect_from_port_20=YES
xferlog_enable=YES
ftpd_banner=FTP Server
secure_chroot_dir=/var/run/vsftpd/empty
pam_service_name=vsftpd
rsa_cert_file=/etc/ssl/certs/ssl-cert-snakeoil.pem
rsa_private_key_file=/etc/ssl/private/ssl-cert-snakeoil.key
ssl_enable=NO
hide_ids=YES
no_anon_password=YES
delay_failed_login=5
max_clients=5
max_per_ip=3
hide_file=.ssh

我的nginx.conf:

user  nginx;
worker_processes  2;
error_log  /var/log/nginx/error.log warn;
pid        /var/run/nginx.pid;
events {
    worker_connections  1024;
}
http {
    include       /etc/nginx/mime.types;
    default_type  application/octet-stream;
    charset utf-8;
    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  /var/log/nginx/access.log  main;
    sendfile        on;
    keepalive_timeout  65;
    include /etc/nginx/conf.d/*.conf;
    server_tokens off;
}

我的conf.d/default.conf(简化):

server {
    listen 80 default_server;
    server_name yshinkarev.ru;
    return 301 https://$server_name$request_uri;
server {
    listen 443 ssl default_server;
    server_name yshinkarev.ru;
    ssl_certificate /etc/letsencrypt/live/yshinkarev.ru/fullchain.pem;
    ssl_certificate_key /etc/letsencrypt/live/yshinkarev.ru/privkey.pem;
    location /.well-known/acme-challenge {
        root /var/www/letsencrypt;
    }
    location /images {
        root   /var/www/nginx;
    }
    error_page  404 =200             /index.html;
}

相关内容