From 0b35042315b2c67ff5037aa7641e74d15dbf6842 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ariel=20Nu=C3=B1ez?= Date: Thu, 18 Aug 2016 10:11:16 -0500 Subject: [PATCH 1/9] Added geoserver config --- nginx.conf | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/nginx.conf b/nginx.conf index 40a04d5..afbeb81 100644 --- a/nginx.conf +++ b/nginx.conf @@ -33,6 +33,11 @@ http { index index.html index.htm; root /usr/share/nginx/html; + location /geoserver { + include proxy_params; + proxy_pass http://geoserver:8080/geoserver; + } + location /{ proxy_pass http://django:8000; From 799598e24c243c47f9dacd0feef500e119842c99 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ariel=20Nu=C3=B1ez?= Date: Thu, 18 Aug 2016 11:50:47 -0500 Subject: [PATCH 2/9] Added proxy params --- nginx.conf | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/nginx.conf b/nginx.conf index afbeb81..ded90be 100644 --- a/nginx.conf +++ b/nginx.conf @@ -34,8 +34,11 @@ http { root /usr/share/nginx/html; location /geoserver { - include proxy_params; proxy_pass http://geoserver:8080/geoserver; + + proxy_redirect off; + proxy_set_header Host $host; + proxy_set_header X-Real-IP $remote_addr; } location /{ From 011ab7430d9b09871f546ff81758bfecaa77ea92 Mon Sep 17 00:00:00 2001 From: Way Barrios Date: Thu, 19 Jan 2017 12:29:05 -0500 Subject: [PATCH 3/9] Adding more client_max_body_size up to 100MB --- nginx.conf | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/nginx.conf b/nginx.conf index ded90be..cb3e346 100644 --- a/nginx.conf +++ b/nginx.conf @@ -39,6 +39,7 @@ http { proxy_redirect off; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; + client_max_body_size 100M; } location /{ @@ -54,7 +55,7 @@ http { return 200; } - client_max_body_size 15M; + client_max_body_size 100M; client_body_buffer_size 128K; add_header Access-Control-Allow-Credentials false; add_header Access-Control-Allow-Headers "Content-Type, Accept, Authorization, Origin, User-Agent"; From 0e80439ff4d52dc266db7d6ffa0f1ef4b6c780be Mon Sep 17 00:00:00 2001 From: Francesco Bartoli Date: Thu, 25 Jan 2018 00:35:39 +0100 Subject: [PATCH 4/9] Fix error 504 connection timeout --- nginx.conf | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/nginx.conf b/nginx.conf index cb3e346..70c794a 100644 --- a/nginx.conf +++ b/nginx.conf @@ -61,7 +61,10 @@ http { add_header Access-Control-Allow-Headers "Content-Type, Accept, Authorization, Origin, User-Agent"; add_header Access-Control-Allow-Methods "GET, POST, PUT, PATCH, OPTIONS"; proxy_set_header X-Forwarded-Protocol $scheme; - proxy_read_timeout 30; + proxy_connect_timeout 600; + proxy_send_timeout 600; + proxy_read_timeout 600; + send_timeout 600; proxy_redirect off; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; From bfba1a805b665f5464166c3245af3418294d8ee3 Mon Sep 17 00:00:00 2001 From: Cezary Statkiewicz Date: Tue, 20 Mar 2018 12:46:04 +0100 Subject: [PATCH 5/9] uwsgi upstream for nginx --- nginx.conf | 54 +++++++++++++++++++++++++++++++++++++++++++++--------- 1 file changed, 45 insertions(+), 9 deletions(-) diff --git a/nginx.conf b/nginx.conf index 40a04d5..c384ca7 100644 --- a/nginx.conf +++ b/nginx.conf @@ -19,6 +19,7 @@ http { '"$http_user_agent" "$http_x_forwarded_for"'; access_log /var/log/nginx/access.log main; + error_log /var/log/nginx/error.log; sendfile on; #tcp_nopush on; @@ -31,11 +32,9 @@ http { server{ listen 80; index index.html index.htm; - root /usr/share/nginx/html; + root /mnt/volumes/statics/; location /{ - proxy_pass http://django:8000; - if ($request_method = OPTIONS) { add_header Access-Control-Allow-Methods "GET, POST, PUT, PATCH, OPTIONS"; add_header Access-Control-Allow-Headers "Authorization, Content-Type, Accept"; @@ -46,20 +45,57 @@ http { return 200; } + try_files $uri @django; + } + + location @django { + + etag off; + expires 0; + include uwsgi_params; + uwsgi_pass uwsgi://django:8000; + client_max_body_size 15M; client_body_buffer_size 128K; add_header Access-Control-Allow-Credentials false; add_header Access-Control-Allow-Headers "Content-Type, Accept, Authorization, Origin, User-Agent"; add_header Access-Control-Allow-Methods "GET, POST, PUT, PATCH, OPTIONS"; - proxy_set_header X-Forwarded-Protocol $scheme; - proxy_read_timeout 30; + uwsgi_read_timeout 30; + } + + + location /geoserver { + etag off; + expires 0; + proxy_pass http://geoserver:8080/geoserver; + proxy_redirect off; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; - proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; - proxy_set_header X-Forwarded-Host $server_name; + client_max_body_size 100M; } - } - + etag on; + gzip on; + + expires 1d; + gzip_disable "msie6"; + gzip_comp_level 6; + gzip_min_length 1100; + gzip_buffers 16 8k; + gzip_proxied any; + gzip_types + text/plain + text/css + text/js + text/xml + text/javascript + application/javascript + application/x-javascript + application/json + application/xml + application/rss+xml + image/svg+xml; + + } #include /etc/nginx/conf.d/*.conf; } From 3d0ed1037f12484431d6922e96a3fd2147ad65a5 Mon Sep 17 00:00:00 2001 From: Cezary Statkiewicz Date: Tue, 20 Mar 2018 17:10:56 +0100 Subject: [PATCH 6/9] use single client_max_body_size value --- nginx.conf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nginx.conf b/nginx.conf index c384ca7..ea7172e 100644 --- a/nginx.conf +++ b/nginx.conf @@ -55,7 +55,7 @@ http { include uwsgi_params; uwsgi_pass uwsgi://django:8000; - client_max_body_size 15M; + client_max_body_size 100M; client_body_buffer_size 128K; add_header Access-Control-Allow-Credentials false; add_header Access-Control-Allow-Headers "Content-Type, Accept, Authorization, Origin, User-Agent"; From 17461248cef015f68f566e95bc3d94dc263f17be Mon Sep 17 00:00:00 2001 From: Cezary Statkiewicz Date: Mon, 9 Apr 2018 11:58:46 +0200 Subject: [PATCH 7/9] use proper body size limit --- nginx.conf | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/nginx.conf b/nginx.conf index ea7172e..51200cf 100644 --- a/nginx.conf +++ b/nginx.conf @@ -55,8 +55,6 @@ http { include uwsgi_params; uwsgi_pass uwsgi://django:8000; - client_max_body_size 100M; - client_body_buffer_size 128K; add_header Access-Control-Allow-Credentials false; add_header Access-Control-Allow-Headers "Content-Type, Accept, Authorization, Origin, User-Agent"; add_header Access-Control-Allow-Methods "GET, POST, PUT, PATCH, OPTIONS"; @@ -72,11 +70,13 @@ http { proxy_redirect off; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; - client_max_body_size 100M; } etag on; gzip on; + client_max_body_size 100M; + client_body_buffer_size 128K; + expires 1d; gzip_disable "msie6"; gzip_comp_level 6; From 96a98cb80718c0844c4534987b6f2c7d9736febf Mon Sep 17 00:00:00 2001 From: Cezary Statkiewicz Date: Mon, 9 Apr 2018 22:08:32 +0200 Subject: [PATCH 8/9] increased timeouts --- nginx.conf | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/nginx.conf b/nginx.conf index 51200cf..d45ec4a 100644 --- a/nginx.conf +++ b/nginx.conf @@ -44,8 +44,7 @@ http { add_header Access-Control-Max-Age 1728000; return 200; } - - try_files $uri @django; + try_files $uri @django; } location @django { @@ -58,7 +57,6 @@ http { add_header Access-Control-Allow-Credentials false; add_header Access-Control-Allow-Headers "Content-Type, Accept, Authorization, Origin, User-Agent"; add_header Access-Control-Allow-Methods "GET, POST, PUT, PATCH, OPTIONS"; - uwsgi_read_timeout 30; } @@ -77,6 +75,12 @@ http { client_max_body_size 100M; client_body_buffer_size 128K; + proxy_connect_timeout 600; + proxy_send_timeout 600; + proxy_read_timeout 600; + send_timeout 600; + uwsgi_read_timeout 600; + expires 1d; gzip_disable "msie6"; gzip_comp_level 6; From 50b31f7c896a89e436323c736be8b56da326a18e Mon Sep 17 00:00:00 2001 From: Alessio Fabiani Date: Mon, 25 Jun 2018 13:27:52 +0200 Subject: [PATCH 9/9] Update Dockerfile