[PHP] 安装PHP报错“Primary script unknown”的解决方法
当安装完最新版的nginx和最新版的PHP以后,使用niginx默认配置文件中的PHP配置会有错误 90#90: *1 FastCGI sent in stderr: "Primary script unknown" while reading response header from upstream,client: 127.0.0.1,server: 127.0.0.1,request: "GET /index.php HTTP/1.1",upstream: "fastcgi://127.0.0.1:9000",host: "127.0.0.1" 排查的过程: fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; 2.把root指令从location /{}块里面拿到外面,因为看fpm的access日志,访问PHP文件报的404错误 最简配置如下: server { listen 80; server_name 127.0.0.1; access_log /var/log/nginx/default.access.log main; error_log /var/log/nginx/default.error.log; root /var/www/html; location / { index index.html index.htm; } location ~ .php$ { fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; include fastcgi_params; } } (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |