dimanche 6 mai 2018

Nginx is downloading PHP files when trying to remove the extension

So, basically my current configuration is like below. Whenever I try and request the URL without the PHP extension it downloads it instead?

server {

      listen [::]:80;

      root myDirectory;

      index index.php index.html;

      server_name myDomain;

      location / {
        try_files $uri $uri/ $uri.php $uri.php$is_args$query_string =404;

      }

      location ~\.php$ {
        include snippets/fastcgi-php.conf;
        fastcgi_split_path_info ^(.+\.php)(/.+)$;
        include fastcgi_params;
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
        fastcgi_param SCRIPT_NAME $fastcgi_script_name;
        fastcgi_pass unix:/run/php/php7.1-fpm.sock;
      }

      location ~ /\ ht {
        deny all;
      }

    }

I've already done what a lot of other answers in other questions have suggested like editing the php7.1-fpm php.ini file:

cgi.fix_pathinfo=0

Any ideas?




Aucun commentaire:

Enregistrer un commentaire