1- upstream puma_server {
2- server unix:/app/file_store/file_store_unicorn.sock fail_timeout=0 ;
1+ upstream fs_server {
2+ server file-store:443 ;
33}
44
55server {
66 listen 80;
77 server_name file-store.openmandriva.org;
88
99 root /app/file_store/public;
10- try_files $uri @puma_server ;
10+ try_files $uri @fs_server ;
1111
12- location @puma_server {
12+ location @fs_server {
1313 proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
1414 proxy_set_header Host $http_host;
1515 proxy_set_header X-Forwarded-Proto https; # if use ssl
1616 proxy_set_header X-Accel-Mapping "/app/file_store/\d{14}/uploads/=/private_files/";
1717 proxy_redirect off;
18- proxy_pass http://puma_server ;
18+ proxy_pass http://fs_server ;
1919 }
2020
2121 location ~ ^/(assets)/ {
@@ -30,35 +30,4 @@ server {
3030 open_file_cache_errors on;
3131 break;
3232 }
33- # Upload form should be submitted to this location
34- location /api/v1/upload {
35- # Pass altered request body to this location
36- upload_pass @puma_server;
37-
38- # Store files to this directory
39- # The directory is hashed, subdirectories 0 1 2 3 4 5 6 7 8 9 should exist
40- upload_store /tmp 1;
41-
42- # Allow uploaded files to be read only by user
43- upload_store_access user:r all:rw;
44-
45- # Set specified fields in request body
46- upload_set_form_field file[name] "$upload_file_name";
47- upload_set_form_field file[content_type] "$upload_content_type";
48- upload_set_form_field file[path] "$upload_tmp_path";
49-
50- # Inform backend about hash and size of a file
51- upload_aggregate_form_field file[sha1] "$upload_file_sha1";
52- upload_aggregate_form_field file[size] "$upload_file_size";
53-
54- upload_pass_form_field "^submit$|^description$";
55-
56- upload_cleanup 400 404 499 500-505;
57- }
58-
59- # send file
60- location /private_files/ {
61- alias /app/file_store/uploads/;
62- internal;
63- }
6433}
0 commit comments