使用Symfony2降低上传速度 - Nginx。 15分钟内100 MB

时间:2017-04-02 12:18:45

标签: performance symfony nginx file-upload

我在Symfony 2.7中有一个表单,可以将100MB到500 MB之间的视频上传到我的网站。上传速度约为700 kbps,因此100MB视频上传时间超过15分钟。这太多了,用户用完了我的网站!我尝试使用Wetransfer,同样的视频上传时间仅为30秒,上传速度为30Mbps。 (湿转移上传速度提高了30倍以上!)

我有一个digitalocean VPS,nginx,symfony2.7应用程序。

我一直在阅读很多Nginx配置并测试不同的配置,但速度仍然非常低。我已经在php.ini,nginx.conf中做了更改,但我不明白发生了什么......

这是我的vps速度:

~$ curl -s  https://raw.githubusercontent.com/sivel/speedtest-cli/master/speedtest.py | python -

Retrieving speedtest.net configuration...
Testing from DigitalOcean (xxx.xxx.xxx.xxx)...
Retrieving speedtest.net server list...
Selecting best server based on ping...
Hosted by Citybridge (New York City, NY) [16.98 km]: 2.628 ms
Testing download speed................................................................................
Download: 380.93 Mbit/s
Testing upload speed....................................................................................................
Upload: 352.91 Mbit/s

Nginx.conf和sites-available / domain:

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

events {
    worker_connections 1024;
   }

http {
    client_max_body_size 1000M;
    client_body_buffer_size 32M;
    proxy_buffer_size 32M;
    proxy_buffers 16 8M;
    client_header_buffer_size 16k;
    large_client_header_buffers 8 16k;

    sendfile on;
    tcp_nopush on;
    tcp_nodelay on;
    keepalive_timeout 65;
    types_hash_max_size 2048;
    server_tokens off;

    include /etc/nginx/mime.types;
    default_type application/octet-stream;

    ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
    access_log /var/log/nginx/access.log;
    error_log /var/log/nginx/error.log;

    gzip on;
    gzip_disable "msie6";
    gzip_types text/css application/x-javascript text/xml application/xml     text/javascript application/javascript text/x-js;
    gzip_vary on;
    gzip_proxied any;
    gzip_comp_level 6;
    gzip_buffers 16 8k;
    gzip_http_version 1.1;

    include /etc/nginx/conf.d/*.conf;
    include /etc/nginx/sites-enabled/*;

}

server {
    listen 443 ssl;
    server_name www.*****.org;
    ssl_certificate /etc/letsencrypt/live/***.org/fullchain.pem;
    ssl_certificate_key /etc/letsencrypt/live/***.org/privkey.pem;
    ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
    ssl_prefer_server_ciphers on;
    ssl_dhparam /etc/ssl/certs/dhparam.pem;
    ssl_ciphers *****;
    ssl_session_timeout 1d;
    ssl_session_cache shared:SSL:50m;
    ssl_stapling on;
    ssl_stapling_verify on;
    add_header Strict-Transport-Security max-age=15768000;
    root /var/www/****/web;
    if ($http_user_agent ~* (libwww-perl) ) {
       return 403;
     }
location ~ /.well-know{
    allow all;
}

location / {
    try_files $uri /app.php$is_args$args;
}
location ~ ^/app\.php(/|$) {
    fastcgi_pass unix:/var/run/php5-fpm.sock;
    fastcgi_split_path_info ^(.+\.php)(/.*)$;
    include fastcgi_params;
    fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
}

error_log /var/log/nginx/***.log;
access_log /var/log/nginx/***.log;

location ~* .(jpg|jpeg|png|gif|ico|css|js)$ {
    expires 1d;
}
}

有什么想法吗?提前致谢

0 个答案:

没有答案