参考:

https://blog.csdn.net/qq_21389693/article/details/105709452

Nginx 浏览.php文件变成下载:这是因为nginx没有设置好碰到php文件时,要传递到后方的php解释器

查看php-fpm进程是否正常

ps aux|grep 'php-fpm'

开启php-fpm

service php-fpm start

配置nginx

location ~ \.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;

}