我无法让分块上传正常工作。即使重新编译 Nginx 也是如此。我在 ubuntu 12.04 上使用 nginx 1.1.19。我下载了 nginx 1.1.19 的源代码和分块上传模块,并按如下方式进行编译。
./configure --prefix=/etc/nginx --sbin-path=/usr/sbin/nginx --user=www-data --group=www-data --conf-path=/etc/nginx/nginx.conf --conf-path=/etc/nginx/nginx.conf --error-log-path=/var/log/nginx/error.log --http-fastcgi-temp-path=/var/lib/nginx/fastcgi --http-log-path=/var/log/nginx/access.log --lock-path=/var/lock/nginx.lock --pid-path=/var/run/nginx.pid --with-debug --with-http_gzip_static_module --with-http_ssl_module --with-sha1=/usr/include/openssl --with-md5=/usr/include/openssl **--add-module=path-to-chunkin-module --with-pcre=/path-to-pre-library.**
编译后我得到了这个:
Configuration summary
+ using PCRE library: /home/www-data/pcre-8.10
+ using system OpenSSL library + md5: using OpenSSL library + sha1: using OpenSSL library
+ using system zlib library
nginx path prefix: "/etc/nginx"
nginx binary file: "/etc/nginx/sbin/nginx"
nginx configuration prefix: "/etc/nginx"
nginx configuration file: "/etc/nginx/nginx.conf" nginx pid file: "/var/run/nginx.pid"
nginx error log file: "/var/log/nginx/error.log" nginx http
access log file: "/var/log/nginx/access.log" nginx http client
**request body temporary files: "client_body_temp"**
**nginx http proxy temporary files: "proxy_temp"**
nginx http fastcgi temporary files: "/var/lib/nginx/fastcgi"
nginx http uwsgi temporary files: "uwsgi_temp" nginx http scgi
temporary files: "scgi_temp"
尽管我不想要代理模块,但我无法使用它来删除它--without-http_proxy-module
。之后我重新启动了 nginx。
nginx -V 显示已编译的模块,其中包含 chunkin 模块和 pcre。但块上传仍然不起作用。我配置sites-enabled/default
并添加了
chunkin on;
error_page 411 = @my_411_error; location @my_411_error {
chunkin_resume; }
但块上传仍然无法进行。curl
输出显示:
curl -I 服务器的 IP 地址
HTTP/1.1 200 OK
Server: nginx
Date: Tue, 17 Jul 2012 20:31:56 GMT
Content-Type: text/html
Content-Length: 4448
Last-Modified: Mon, 11 Jun 2012 18:02:19 GMT
Connection: keep-alive
Accept-Ranges: bytes
我正进入(状态411 错误在访问日志中。
答案1
在 /etc/nginx.conf 中设置 client_max_body_size 并重新启动 nginx 后解决