遇到一个第三方后台cms安装失败的问题

tp5安装第三方的cms后台

总是遇到File not found的问题

在var/log/nginx/error.log中发现是这个错误

 [error] 3926#0: *33481 FastCGI sent in stderr: "Primary script unknown" while reading response head

nginx配置也找了半天,都是说什么$document_root的问题,但仔细核对后我的配置都没问题。

后来突然想到一点,在/etc/nginx/vhost中,对各个域名对应的文件 xx8sd9.conf

我总是习惯直接配置根目录

root /data/www/xx8sd9
导致第三方的cms系统总是找不到应该找的安装目录,
然后直接指定根目录为安装目录
root /data/www/xx8sd9/public;

问题解决,安装成功


其实第三方CMS系统,人家已提醒根目录设置为public或者install,只是自己习惯了总是在域名下,哎,

下面是我正确的配置

server
{
listen 80;
server_name www.xx8sd9.com xx8sd9.com;

root /data/www/xx8sd9/public;
index index.php index.html index.htm;


location / {
if (!-e $request_filename){
rewrite ^(.*)$ /index.php?s=$1 last;
}
}

location ~ .php$ {
try_files $uri =404;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_split_path_info ^(.+.php)(.*)$;
fastcgi_param PATH_INFO $fastcgi_path_info;
include fastcgi_params;
}

}

  

安装成功后的

原文地址:https://www.cnblogs.com/yuzhould/p/13462334.html