安装 PHP 和 nginx 后,无法解析 PHP 文件。
其中,PHP 和 nginx 的编译安装 configure 如下:
# PHP 5.3.9
./configure --prefix=/usr/local/php -- enable-fpm
# nginx 1.0.11
./configure --prefix=usr/local/nginx
# 成功安装后,创建 php-fpm.conf 配置文件,删除 nginx.conf 中“pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000”部分的注释
cd /usr/local/php/etc
mv php-fpm.conf.default php-fpm.conf
vi /usr/local/nginx/conf/nginx.conf
# 删除如下部分的注释,保存退出,
location ~ \.php$ {
root html;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME /usr/local/nginx/html$fastcgi_script_name;
include fastcgi_params;
}

本文详细介绍了在安装PHP和nginx后遇到无法解析PHP文件的问题,通过调整配置文件并重新启动服务,成功解决了该问题。
3852

被折叠的 条评论
为什么被折叠?



