文章目录
以下的解决方法前提是:已经完成安装了Nginx和PHP。
进程php-fpm是否开启
有时候就是因为php-fpm进程未开启,网址无法解析php文件
// 查看是否开启
systemctl status php-fpm
// 如果没有开启,则开启
systemctl start php-fpm
Nginx 的网站配置文件
查看 "/etc/nginx/my.conf",或者对应网站的conf文件,比如"/etc/nginx/conf.d/*.conf",确保有解析php的配置
location ~ \.php$ {
root /usr/share/nginx/***;
astcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
如果使用的是centos8以上,则需要将Nginx配置文件中的astcgi_pass,改成"php-fpm"