Forum: NGINX Problem with client_max_body_size

Posted by dast@c-base (Guest)
on 2013-02-05 15:08
(Received via mailing list)
Hi,

i want to use Nginx with apache2 and mod_dav_svn for hosting my SVN 
Repository via https.

But i have problems on commit large files.

On a 8MB ffmpeg binary commit, my SVN client brings this error:
Commit failed (details follow):
Server sent unexpected return value (413 Request Entity Too Large) in 
response to PUT request for 
'/svn/repo1/!svn/wrk/b2f0560a-05fd-427c-9039-d47dea9ff9c4/path/ffmpeg'


The Nginx error log says:


2013/02/05 14:20:25 [error] 22931#0: *2693 client intended to send too 
large body: 8309431 bytes, client: 93.220.123.123, server: mydomain.com, 
request: "PUT 
/svn/repo1/!svn/wrk/b2f0560a-05fd-427c-9039-ababea9ff9c4/path/ffmpeg 
HTTP/1.1", host: "mydomain.com"


And nothing about the request in the apache logs.
So i think the nginx blocks the request, not the proxy to apache.


The Requests to the Nginx goes over HTTPS:

https://public-domain.com/svn/ (nginx)     <>    routing to 
http://localhost:8080  (apache2)


My Nginx config already has client_max_body_size 256M; in the nginx.conf 
inside http { } and server { } in the vost site config.
But it does not helps or is ignored.

i have searched all other nginx configfiles for "client_max_body_size" 
without succes:

#> grep -R 'client_max_body_size' ./*
./nginx.conf:   client_max_body_size    256M;
./sites-available/443_mydomain.com:      client_max_body_size    256M;
./sites-available/443_mydomain.com:      client_max_body_size    256M;
./sites-enabled/443_mydomain.com:        client_max_body_size    256M;
./sites-enabled/443_mydomain.com:        client_max_body_size    256M;


my site config file:


server {
  listen   443;
  server_name mydomain.com;

  client_max_body_size    256M;

  ssl    on;
  ssl_certificate 
/path/ssl-cert/nginx/mydomain.com.2013-01.cacert.crt;
  ssl_certificate_key     /path/ssl-cert/nginx/mydomain.com.2013-01.key;

  access_log /path/logs/nginx.https.mydomain.com.access.log;
  error_log /path/logs/nginx.https.mydomain.com.error.log debug;

  root /path/htdocs/mydomain.com;
  index index.php index.html;

  location / {
      try_files $uri $uri/ /index.php;
  }

  location /svn {
      client_max_body_size    256M;
      keepalive_timeout  60;
      include         /etc/nginx/proxy_params;
      proxy_pass      http://127.0.0.1:8080;
      set  $dest  $http_destination;
      if ($http_destination ~ "^https://(.+)") {
         set  $dest   http://$1;
      }
      proxy_set_header  Destination   $dest;
  }

}


So, what can i check?
What is wrong in my config?
Why is client_max_body_size ignored?
Does client_max_body_size not work on https?
Does client_max_body_size not work on PUT requests?

After 2 days of testing i hav no idea that to check. :(

best regards,
Daniel.
Posted by dast@c-base (Guest)
on 2013-02-05 15:41
(Received via mailing list)
forgot my version:

# >nginx -V
nginx version: nginx/1.1.19
TLS SNI support enabled
configure arguments: --prefix=/etc/nginx 
--conf-path=/etc/nginx/nginx.conf 
--error-log-path=/var/log/nginx/error.log 
--http-client-body-temp-path=/var/lib/nginx/body 
--http-fastcgi-temp-path=/var/lib/nginx/fastcgi 
--http-log-path=/var/log/nginx/access.log 
--http-proxy-temp-path=/var/lib/nginx/proxy 
--http-scgi-temp-path=/var/lib/nginx/scgi 
--http-uwsgi-temp-path=/var/lib/nginx/uwsgi 
--lock-path=/var/lock/nginx.lock --pid-path=/var/run/nginx.pid 
--with-debug --with-http_addition_module --with-http_dav_module 
--with-http_flv_module --with-http_geoip_module 
--with-http_gzip_static_module --with-http_image_filter_module 
--with-http_mp4_module --with-http_perl_module 
--with-http_random_index_module --with-http_realip_module 
--with-http_secure_link_module --with-http_stub_status_module 
--with-http_ssl_module --with-http_sub_module --with-http_xslt_module 
--with-ipv6 --with-sha1=/usr/include/openssl 
--with-md5=/usr/include/openssl --with-mail --with-mail_ssl_module 
--add-module=/build/buildd/nginx-1.1.19/debian/modules/nginx-auth-pam 
--add-module=/build/buildd/nginx-1.1.19/debian/modules/chunkin-nginx-module 
--add-module=/build/buildd/nginx-1.1.19/debian/modules/headers-more-nginx-module 
--add-module=/build/buildd/nginx-1.1.19/debian/modules/nginx-development-kit 
--add-module=/build/buildd/nginx-1.1.19/debian/modules/nginx-echo 
--add-module=/build/buildd/nginx-1.1.19/debian/modules/nginx-http-push 
--add-module=/build/buildd/nginx-1.1.19/debian/modules/nginx-lua 
--add-module=/build/buildd/nginx-1.1.19/debian/modules/nginx-upload-module 
--add-module=/build/buildd/nginx-1.1.19/debian/modules/nginx-upload-progress 
--add-module=/build/buildd/nginx-1.1.19/debian/modules/nginx-upstream-fair 
--add-module=/build/buildd/nginx-1.1.19/debian/modules/nginx-dav-ext-module

Am 05.02.2013 um 15:08 schrieb dast@c-base <dast@c-base.org>:
Posted by basti (Guest)
on 2013-02-05 15:52
(Received via mailing list)
If your site use PHP so have a look on your php.ini

there are 2 param's:

upload_max_filesize
post_max_size



Am 05.02.2013 15:08, schrieb dast@c-base:
Posted by dast@c-base (Guest)
on 2013-02-05 16:03
(Received via mailing list)
Hi Basti,

thanks for ur answer.

no - its no PHP involved.

Its only proxy to apache localhost:8080 where the mod_dav_svn handles 
the request.

best regards,
daniel.

Am 05.02.2013 um 15:51 schrieb basti <black.fledermaus@arcor.de>:
Posted by Maxim Dounin (Guest)
on 2013-02-05 16:08
(Received via mailing list)
Hello!

On Tue, Feb 05, 2013 at 03:08:03PM +0100, dast@c-base wrote:

[...]

> So, what can i check?
> What is wrong in my config?
> Why is client_max_body_size ignored?
> Does client_max_body_size not work on https?
> Does client_max_body_size not work on PUT requests?
>
> After 2 days of testing i hav no idea that to check. :(

Try starting with "nginx -t".  Or, more precisely, making sure the
configuration you have on disk is actually loaded into nginx.

I suspect your problem is that there is some error in your config,
and nginx refuses to reload configuration due to it (nginx will
complain into global error log in such a case, but it is proven to
be easy to overlook).

--
Maxim Dounin
http://nginx.com/support.html
Posted by dast@c-base (Guest)
on 2013-02-05 16:23
(Received via mailing list)
Hi Maxim,

i have checked /var/log/syslog - but no entrys about nginx.
same in /var/log/nginx/error.log.

i only found this in nginx error.log on restart:

2013/02/05 16:21:13 [info] 26394#0: Using 32768KiB of shared memory for 
push module in /etc/nginx/nginx.conf:80


# >/etc/init.d/nginx configtest
Testing nginx configuration: Enter PEM pass phrase:
nginx.
# >echo $?
0

and

# >nginx -t
Enter PEM pass phrase:
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful

any ideas?

best regards,
Daniel.


Am 05.02.2013 um 16:08 schrieb Maxim Dounin <mdounin@mdounin.ru>:
Posted by Maxim Dounin (Guest)
on 2013-02-05 16:43
(Received via mailing list)
Hello!

On Tue, Feb 05, 2013 at 04:23:08PM +0100, dast@c-base wrote:

> # >/etc/init.d/nginx configtest
> nginx: configuration file /etc/nginx/nginx.conf test is successful
>
> any ideas?

Try showing full nginx config you use (that is, nginx.conf and
all included files).

--
Maxim Dounin
http://nginx.com/support.html
Posted by dast@c-base (Guest)
on 2013-02-05 17:10
(Received via mailing list)
WTF, it works now :(

what i have done:

 - backup /etc/nginx
 - removed all commented lines in the config files in /etc/nginx
 - stoped nginx
 - start nginx (from now nginx asks 2 times for the ssl-cert passthrase, 
on restart too, before it only asked one time for the passthrase on 
restart)
 - tested svn commit - and now committing 8MB File works fine

now i was confused.

i restored backup'd config (/etc/nginx) and restarted nginx - still 
works

stoped and started nginx - still work.

so:
can it be, that a "/etc/init.d/nginx restart" has not loaded my changed 
config?
and a stop+start has oared the new config and now it use the 
client_max_body_size config?

on all my tests last 2 days i have only used the "restart" command - not 
stop+start.


best regards,
Daniel.


Am 05.02.2013 um 16:42 schrieb Maxim Dounin <mdounin@mdounin.ru>:
Please log in before posting. Registration is free and takes only a minute.
Existing account (Switch to SSL-encrypted connection)
NEW: Do you have a Google/GoogleMail or Yahoo account? No registration required!
Log in with Google account | Log in with Yahoo account
No account? Register here.