{"action":"created","issue":{"url":"https://api.github.com/repos/cfsego/limit_upload_rate/issues/5","repository_url":"https://api.github.com/repos/cfsego/limit_upload_rate","labels_url":"https://api.github.com/repos/cfsego/limit_upload_rate/issues/5/labels{/name}","comments_url":"https://api.github.com/repos/cfsego/limit_upload_rate/issues/5/comments","events_url":"https://api.github.com/repos/cfsego/limit_upload_rate/issues/5/events","html_url":"https://github.com/cfsego/limit_upload_rate/issues/5","id":167771335,"number":5,"title":"没有限制住速度","user":{"login":"theburn","id":1833322,"avatar_url":"https://avatars.githubusercontent.com/u/1833322?v=3","gravatar_id":"","url":"https://api.github.com/users/theburn","html_url":"https://github.com/theburn","followers_url":"https://api.github.com/users/theburn/followers","following_url":"https://api.github.com/users/theburn/following{/other_user}","gists_url":"https://api.github.com/users/theburn/gists{/gist_id}","starred_url":"https://api.github.com/users/theburn/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/theburn/subscriptions","organizations_url":"https://api.github.com/users/theburn/orgs","repos_url":"https://api.github.com/users/theburn/repos","events_url":"https://api.github.com/users/theburn/events{/privacy}","received_events_url":"https://api.github.com/users/theburn/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2016-07-27T05:04:40Z","updated_at":"2016-09-27T07:32:26Z","closed_at":null,"body":"* 测试版本为：2.1.2和1.5.2版本的Tengine\r\n\r\n我用自己写的后端上传服务用nginx做反向代理，然后在 /upload/ 的location中配置了\r\n```nginx\r\n            limit_upload_rate 500k;  \r\n            limit_upload_rate_after 1m;\r\n```\r\n但是测试下来，上传速度还是超过了500k。\r\n\r\n* Nginx.conf 如下：\r\n```nginx\r\nuser              nginx;\r\nworker_processes  1;\r\n\r\nerror_log  /var/log/nginx/error.log;\r\n\r\npid        /var/run/nginx.pid;\r\n\r\nevents {\r\n    use   epoll;\r\n    worker_connections  1024;\r\n}\r\n\r\n\r\nhttp {\r\n    charset utf-8;\r\n    include       mime.types;\r\n    default_type  application/octet-stream;\r\n\r\n    log_format  main  '$remote_addr - $remote_user [$time_local] \"$request\" '\r\n        '$status $body_bytes_sent \"$http_referer\" '\r\n        '\"$http_user_agent\" \"$http_x_forwarded_for\"';\r\n\r\n    access_log  /var/log/nginx/access.log  main;\r\n\r\n    sendfile        on;\r\n    keepalive_timeout  65;\r\n\r\n    server_tokens off;\r\n    gzip  on;\r\n\r\n    client_header_buffer_size    8k;\r\n    large_client_header_buffers  4 4k;\r\n\r\n\r\n    upstream mysrv {\r\n        server 192.168.149.20:5000;\r\n    }\r\n\r\n\r\n    limit_conn_zone $binary_remote_addr zone=one:10m;\r\n    limit_req_zone $binary_remote_addr zone=req_one:10m rate=1r/s;\r\n\r\n    server {\r\n        listen       80;\r\n        server_name  _;\r\n\r\n        access_log  /var/log/nginx/domain_access.log  main; \r\n\r\n\tlocation /upload {\r\n\t    proxy_pass http://mysrv;\r\n           # limit_conn one 1;\r\n\t    limit_upload_rate 500k;  \r\n            limit_upload_rate_after 1m;\r\n            proxy_set_header Host $host;\r\n            proxy_set_header X-Real-IP $remote_addr;\r\n            proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;\r\n            proxy_connect_timeout 90;\r\n            proxy_send_timeout 90;\r\n            proxy_read_timeout 90;\r\n           \r\n\r\n        }\r\n\r\n        location / {\r\n\t    proxy_pass http://mysrv;\r\n\r\n            proxy_set_header Host $host;\r\n            proxy_set_header X-Real-IP $remote_addr;\r\n            proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;\r\n            proxy_connect_timeout 90;   \r\n            proxy_send_timeout 90;     \r\n            proxy_read_timeout 90;    \r\n            proxy_buffer_size 4k;    \r\n            proxy_buffers 4 32k;    \r\n            proxy_busy_buffers_size 64k; \r\n            proxy_temp_file_write_size 64k; \r\n        }\r\n\r\n        error_page  404 403           /40x.html;\r\n        location = /40x.html {\r\n            root   /data;\r\n        }\r\n\r\n        error_page   500 502 503 504 /50x.html;  \r\n        location = /50x.html {\r\n            root   /data;\r\n        }\r\n        location ~ /\\.ht {\r\n            deny all;\r\n        }\r\n\r\n    }\r\n\r\n}\r\n```\r\n\r\n```bash\r\nShell> ./sbin/nginx  -V 2>&1 | grep limit\r\nconfigure arguments: --prefix=/root/Tengine/tengine-1.5.2 --add-module=limit_upload_rate\r\n    ngx_http_limit_conn_module (static)\r\n    ngx_http_limit_req_module (static)\r\n    ngx_http_limit_upload_module (static)\r\n```"},"comment":{"url":"https://api.github.com/repos/cfsego/limit_upload_rate/issues/comments/249788109","html_url":"https://github.com/cfsego/limit_upload_rate/issues/5#issuecomment-249788109","issue_url":"https://api.github.com/repos/cfsego/limit_upload_rate/issues/5","id":249788109,"user":{"login":"cfsego","id":1188207,"avatar_url":"https://avatars.githubusercontent.com/u/1188207?v=3","gravatar_id":"","url":"https://api.github.com/users/cfsego","html_url":"https://github.com/cfsego","followers_url":"https://api.github.com/users/cfsego/followers","following_url":"https://api.github.com/users/cfsego/following{/other_user}","gists_url":"https://api.github.com/users/cfsego/gists{/gist_id}","starred_url":"https://api.github.com/users/cfsego/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cfsego/subscriptions","organizations_url":"https://api.github.com/users/cfsego/orgs","repos_url":"https://api.github.com/users/cfsego/repos","events_url":"https://api.github.com/users/cfsego/events{/privacy}","received_events_url":"https://api.github.com/users/cfsego/received_events","type":"User","site_admin":false},"created_at":"2016-09-27T07:32:26Z","updated_at":"2016-09-27T07:32:26Z","body":"没有上下文。测试文件大小，测速方式等等。"}}
{"actor":{"display_login":"cfsego"}}