A
A
Alexander2020-06-04 12:39:23
Nginx
Alexander, 2020-06-04 12:39:23

Nginx + PHP-FPM - How to download .zip?

Set a separate location for uploading files. When connecting PHP-FPM, some file formats like .zip or .txt cannot be downloaded, error 404 Not Found.
Other extensions like .7zip or .ISO download without problems.
For example, you can see here https://ustim.ru/soft/music/vsti/toontrack/ezbass/

If you remove the PHP connection and give it to pure NGINX, then everything downloads fine.
As far as I understand, these are the limitations of PHP. Is it possible to remove these restrictions and allow downloading ZIP and other files?

Here is the complete config... removed only the certificates and the https redirect.

server {
  listen 80;
  server_name www.ustim.ru ustim.ru;
  charset UTF-8;

        root /var/www/ustim.ru/;
        include /etc/nginx/templates/php7.4-fpm.conf;
        index index.html index.htm index.php;
        limit_rate 1000k;

        location /app.php {
                try_files $uri $uri/ /app.php?$query_string;
        }
        location /install/app.php {
                try_files $uri $uri/ /install/app.php?$query_string;
        }
        location / {
            try_files $uri $uri/ /index.php?$args;
        }

    location /soft {
        alias /mnt/fs-soft/;
        autoindex on;
        autoindex_exact_size off;
        autoindex_localtime on;
        dav_access user:rw group:rw all:rw;
        dav_methods PUT DELETE MKCOL COPY MOVE;
        create_full_put_path on;
        client_max_body_size 10G;
   }

        error_log /var/log/nginx/ustim.ru_error.log crit;

}

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question