开发者

Nginx serves static data very slowly

I host a RoR application behind a nginx reverse proxy and configured nginx to serve directly all static data, without passing it to the RoR app (hosted by Thin server).

The funny thing now is that images, stylesheets, javascripts, etc. are downloaded really, really slow < 10kB/s. But if i try to download the same file from the Thin server directly it is delivered at full speed > 1MB/s.

Example:

www.example.com/files/big_file.zip -> very sloooow

www.example.com:3000/files/big_file.zip -> very faaaast

Does someone have an idea, where this bottleneck might happen? Or could someone provide me with some nginx configuration ideas?

Some more information about the environment: Intel Core i7-920 Quad-Core 8GB Ram

Debian Squeeze Nginx 1.0.6

This is the nginx.conf

user  www-data;
worker_processes  1;

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;

    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;
    #tcp_nopush     on;

    keepalive_timeout  65;

    #gzip  on;


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

    # increase upload file sieze
    client_max_body_size 200M;
}

Best Regards, El Knokki


I am having the exact same issue with a ruby rack application (sinatra), unicorn and nginx. I feel like an idiot because I have rented a German dedicated server with exactly the same specs like yours for that purpose. My workaround consists of having all that stuff put up to S3/Cloudfront for the moment as I couldn't find the root of the problem. Not amusing but hopefully will help under load meanwhile.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜