通过yum
搭建了下Centos
下nginx+php + mysql的环境,但是访问localhost的时候,变成了下载文件。
把默认的nginx.conf
里面的server
段全部删除了,加载了虚拟主机配置的文件,发现虚拟主机配置文件中有个小地方没有改,无法解析PHP,所以一直变成下载。
location ~ \.php$ {
root html;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name;
include fastcgi_params;
}
把/scripts
修改成$document_root
即可
location ~ \.php$ {
root html;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
}