M
M
My joy2019-06-04 20:50:52
Nginx
My joy, 2019-06-04 20:50:52

How to setup files for download in nginx?

Hi friends.
There is a simple config:

# фронт
server {
  
  listen 80;
  server_name mysite.ru;

  root /var/www/crm/elc/frontend/web;
  index index.php;

  error_log /var/www/logs/crm.error.log;
  access_log /var/www/logs/crm.access.log;

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

  location ~ \.php$ {
    include snippets/fastcgi-php.conf;
    fastcgi_pass unix:/run/php/php7.1-fpm.sock;
  }

  location ~ /\.ht {
    deny all;
  }
  
}

among other things, I threw files that can be viewed / downloaded to the root of the site, but nginx gives errors on them:
InstallWeb .cab (404 error)
activex .certificate (403 error)
what should I write in the nginx config so that they become available for downloading / viewing?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
K
ky0, 2019-06-04
@t-alexashka

File extensions have nothing to do with it. Make sure that the files are located exactly in /var/www/crm/elc/frontend/weband when requested, nothing is messed up with the case of characters (or even better - bring the names to the lower one), and also that the www-data user (or another one from which the web server is running) has read permissions for these files.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question