L
L
lolka022020-01-10 14:53:37
Nginx
lolka02, 2020-01-10 14:53:37

Why is an incomprehensible file (nginx) downloaded when I go to the domain home page?

ispmanager nginx+php-fpm is installed on the server
when adding a site, it generates the config itself

server {
  server_name domain.ru www.domain.ru;
  charset UTF-8;
  index index.php index.html;
  disable_symlinks if_not_owner from=$root_path;
  include /etc/nginx/vhosts-includes/*.conf;
  include /etc/nginx/vhosts-resources/domain.ru/*.conf;
  access_log /home/httpd-logs/domain.ru.access.log;
  error_log /home/httpd-logs/domain.ru.error.log notice;
  ssi on;
  set $root_path /home/domain/data/www/domain.ru;
  root $root_path;
  gzip on;
  gzip_comp_level 4;
  gzip_disable "msie6";
  gzip_types text/plain text/css application/json application/x-javascript text/xml application/xml application/xml+rss text/javascript application/javascript;
  location / {
    location ~ [^/]\.ph(p\d*|tml)$ {
                        try_files /does_not_exists @php;
                }
                if (!-f $request_filename) {
                rewrite ^.*$ /index.php last;
                break;
                }

    location ~* ^.+\.(jpg|jpeg|gif|png|svg|js|css|mp3|ogg|mpe?g|avi|zip|gz|bz2?|rar|swf)$ {
      expires 30d;
    }
  }
    
  location @php {
    fastcgi_index index.php;
    fastcgi_param PHP_ADMIN_VALUE "sendmail_path = /usr/sbin/sendmail -t -i -f [email protected]";
    fastcgi_pass unix:/var/www/php-fpm/domain.sock;
    fastcgi_split_path_info ^((?U).+\.ph(?:p\d*|tml))(/?.+)$;
    try_files $uri =404;
    include fastcgi_params;
  }
  listen 80;
}

When I open the site, an incomprehensible download file is downloaded. What's wrong?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
akelsey, 2020-01-10
@akelsey

It's hard to say, just a guess - the browser requests certain information from the server, the server responds, returns a response with some content-type, the browser is expected to know what to do with it, but the browser does not understand and tries to save it as a file (maybe even nginx renders it with that content-type).
The simplest thing you can do and understand why this is happening is to put Fiddler (or even Wireshark is suitable for htpp) in the context and see how the dialogue between the server and client goes in order to understand the reason.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question