1.配置nginx.conf文件
location ~ \.php(.*)$ {
fastcgi_pass unix:/tmp/php-cgi.sock;
fastcgi_index index.php;
fastcgi_split_path_info ^((?U).+\.php)(/?.+)$;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param PATH_INFO $fastcgi_path_info;
fastcgi_param PATH_TRANSLATED $document_root$fastcgi_path_info;
include fastcgi_params;
}
2.配置绑定网站目录配置文件 www.test.com.conf
listen 127.0.0.1:9000;
#listen [::]:80;
server_name www.cygfast.club cygfast.club;
index.html index.htm index.php default.html default.htm default.php;
root /data/www/blog/public;
include rewrite/other.conf;
include enable-php-pathinfo.conf;
3.检查enable-php.conf配置文件
location ~ [^/]\.php(/|$)
{
try_files $uri =404;
fastcgi_pass unix:/tmp/php-cgi.sock;
fastcgi_index index.php;
include fastcgi.conf;
}
4.检查fastcgi.conf配置文件
# fastcgi_param PHP_ADMIN_VALUE "open_basedir=$document_root/:/tmp/:/proc/";
该配置注销之后修改为
fastcgi_param PHP_ADMIN_VALUE "open_basedir=/data/www/:/tmp/:/proc/";
/data/www为你的项目目录,为了解决访问index.php报出来的错误 ,错误如下图所示
5.出现错误的时候可以在index.php文件里加入如下代码 ,查看什么错误
error_reporting(E_ALL); ini_set('display_errors', '1');