Skip to content

Commit

Permalink
Bugfix: update nginx configuration to adapt to upload large files (#589)
Browse files Browse the repository at this point in the history
* Bugfix: update nginx configuration

* fix alert

* Update nginx.conf
  • Loading branch information
zhou9584 committed Sep 11, 2023
1 parent 8da7d5b commit 04ec4ea
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
10 changes: 8 additions & 2 deletions center/deploy_startup/nginx.conf
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@

#user nobody;
worker_processes 4;
worker_processes auto;

#error_log logs/error.log;
#error_log logs/error.log notice;
Expand Down Expand Up @@ -58,8 +58,14 @@ http {

location / {
proxy_pass http://localhost:9886;
proxy_set_header Host $http_host;

send_timeout 300s;
# When buffering is disabled, the response is passed to a client synchronously, immediately as it is received. nginx will not try to read the whole response from the proxied server. More details in https://nginx.org/en/docs/http/ngx_http_proxy_module.html#proxy_buffering
proxy_buffering off;
client_max_body_size 2000m;
proxy_set_header Host $http_host;
proxy_request_buffering off;
proxy_socket_keepalive on;
}

# center ws redirect
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,9 +72,8 @@ public String upload(File file, StorageFileInfo storageFileInfo) {
body.add("fileUri", fileUri);
HttpEntity<LinkedMultiValueMap<String, Object>> entity = new HttpEntity<>(body, headers);

ResponseEntity<String> responseAsStr = restTemplateHttps.exchange(this.getUploadUrl(), HttpMethod.POST, entity, String.class);
JSONObject responseObject = JSONObject.parseObject(responseAsStr.getBody());
return this.endpoint + Const.LocalStorageURL.CENTER_LOCAL_STORAGE_DOWNLOAD + "/" + responseObject.getString("content");
ResponseEntity<JSONObject> responseObject = restTemplateHttps.exchange(this.getUploadUrl(), HttpMethod.POST, entity, JSONObject.class);
return this.endpoint + Const.LocalStorageURL.CENTER_LOCAL_STORAGE_DOWNLOAD + "/" + responseObject.getBody().getString("content");
}

/**
Expand Down

0 comments on commit 04ec4ea

Please sign in to comment.