You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
<b>that should not be lower than the nginx timeout</b>)
366
+
and <code>client_max_body_size</code> sets the maximum size
367
+
368
+
(a snippet of the nbinx file is also at the bottom of this document).
355
369
356
370
<h1>Server installation</h1>
357
371
@@ -770,24 +784,40 @@ <h3>NGINX</h3>
770
784
keepalive_timeout 70;
771
785
# certificate (must be configured for https, tutorial not covered here. For non-secure connection, you can comment out the following lines):
772
786
ssl_certificate /etc/ssl/certs/egsim.chain.txt; # file is not there by default, to be added
773
-
ssl_certificate_key /etc/ssl/private/$DOMAIN.key; # file is not there by default, to be added
774
-
ssl_session_cache shared:SSL:10m;
775
-
ssl_session_timeout 10m;
776
-
location / {
787
+
ssl_certificate_key /etc/ssl/private/$DOMAIN.key; # file is not there by default, to be added
788
+
ssl_session_cache shared:SSL:10m;
789
+
ssl_session_timeout 10m;
790
+
791
+
location / {
777
792
proxy_pass http://localhost:$GUNICORN_PORT;
778
-
proxy_read_timeout 180s; # this should match proxy server timeout (gunicorn, uwsgi,...) in the gunicorn service file
793
+
# Time limits. Keep them all the same for simplicity. IMPORTANT: when changing these, change also the text in custom_timeout_exceeded (see below)
794
+
proxy_connect_timeout 180s; # How long to wait for a connection to the upstream
795
+
proxy_send_timeout 180s; # How long to wait for the upstream server to send data
796
+
proxy_read_timeout 180s; # How long to wait for the upstream server to respond. It should be >= the proxy server timeout (gunicorn, uwsgi,...). See gunicorn service file
779
797
proxy_set_header Host $http_host;
780
-
proxy_redirect off;
781
-
proxy_set_header X-Forwarded-For $remote_addr;
782
-
proxy_set_header X-Forwarded-Proto $scheme;
783
-
client_max_body_size 20m;
798
+
proxy_redirect off;
799
+
proxy_set_header X-Forwarded-For $remote_addr;
800
+
proxy_set_header X-Forwarded-Proto $scheme;
801
+
client_max_body_size 25M; # max body size, change also @custom_size_limit_exceeded message if you change this
784
802
}
785
803
location /static/ {
786
804
alias /var/cache/$DJANGO_PROJECT/static/;
787
805
}
788
806
location /media/ {
789
807
alias $EGSIM_DATA_DIR/media/;
790
808
}
809
+
# Return a text response for 413 error, likely it is a flatfile size problem
810
+
error_page 413 = @custom_size_limit_exceeded;
811
+
# Return a text response for 502 (gunicorn timeout) and 504 (nginx timeout) errors, likely they are timeout problems
812
+
error_page 502 504 = @custom_timeout_exceeded;
813
+
# Custom location for 404 error response
814
+
location @custom_size_limit_exceeded {
815
+
return 413 'Data size too large (max 25 Mb allowed). If you uploaded a flatfile, try to remove unnecessary fields (columns) and try again';
816
+
}
817
+
# Custom location for 500 error response
818
+
location @custom_timeout_exceeded {
819
+
return 504 'Processing takes too long (max 180 s allowed). If you can, try to decrease the number of models, imts or flatfile records (rows) and try again';
0 commit comments