我需要configurationnginx + gunicorn才能够在两个服务器上传大于默认最大大小的文件。
我的nginx .conf文件如下所示:
server { # ... location / { proxy_pass_header Server; proxy_set_header Host $http_host; proxy_redirect off; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Scheme $scheme; proxy_connect_timeout 60; proxy_pass http://localhost:8000/; } }
这个想法是允许两个地点20M的请求:
/admin/path/to/upload?param=value /installer/other/path/to/upload?param=value 我已经尝试添加location指令在相同的水平比我在这里粘贴(获得404错误),也试图将它们添加到location /指令(获得413 Entity Too Large错误)。
我的位置指令看起来像这些最简单的forms:
location /admin/path/to/upload/ { client_max_body_size 20M; } location /installer/other/path/to/upload/ { client_max_body_size 20M; }
但他们不工作(实际上我testing了很多组合,我绝望地想着这个。
请帮助如果可以的话:我需要设置哪些设置才能使其工作?
非常感谢!
这终于奏效了这样的事情:
location / { proxy_pass_header Server; proxy_set_header Host $http_host; proxy_redirect off; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Scheme $scheme; proxy_set_header X-Forwarded-Protocol ssl; proxy_connect_timeout 120; proxy_pass http://localhost:8000/; location /admin/path/to/upload { client_max_body_size 50m; proxy_pass http://localhost:8000/admin/path/to/upload; } }
听起来就像在非根目录中有client_max_body_size一样,它几乎可以工作。 你还设置了dav_methods PUT; 在你的nginx conf启用PUT和DELETE请求?