To solve the problem of nginx accessing PHP file into download

Nginx browses.php files into downloads: this is because Nginx is not set to pass to the PHP interpreter

when it touches PHP files

  • check if the php-fpm process is working properly
ps aux|grep 'php-fpm'

Open PHP – FPM

  • service php-fpm start
    
    • configure nginx
      ocation ~ \.php$ {
      	fastcgi_pass 127.0.0.1:9000;#php-fpm的默认端口是9000
      	fastcgi_index index.php;
      	fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
      	include fastcgi_params;
      }