laravel新部署项目后nginx报错Primary script unknown

nginx报错如下

2019/05/05 07:34:51 [error] 9977#9977: 
*14 FastCGI sent in stderr: "Primary script unknown" while reading response header from upstream,
 client: 223.104.64.224,
 server: ***.top,
 request: "POST /api/index HTTP/1.1",
 upstream: "fastcgi://unix:/run/php/php7.0-fpm.sock:",
 host: "***.top"

nginx配置

server {  
        listen  80;    
        server_name ***.top;    
        set $root_path '/var/www/html/douyin_laravel/public';    
        root $root_path;
        
        index index.php index.html index.htm;    
        
        try_files $uri $uri/ @rewrite;    
        
        location @rewrite {    
            rewrite ^/(.*)$ /index.php?_url=/$1;    
        }    
        
        location ~ \.php {    
        
            fastcgi_pass unix:/run/php/php7.0-fpm.sock;
            fastcgi_index /index.php;    
        
            fastcgi_split_path_info       ^(.+\.php)(/.+)$;    
            fastcgi_param PATH_INFO       $fastcgi_path_info;    
            fastcgi_param PATH_TRANSLATED $document_root$fastcgi_path_info;    
            fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;    
            include                       fastcgi_params;  
        }
        
        location ~* ^/(css|img|js|flv|swf|download)/(.+)$ {    
            root $root_path;    
        }    
        
        location ~ /\.ht {    
            deny all;    
        }    
}

执行 ps aux|grep php结果
图片描述

项目目录权限也都是777

我看网上的解决办法都是这样的链接描述 但是我看了一下我nginx配置中我本来就有这句话fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
大家能帮我看看是哪里的问题吗?

阅读 3.2k
1 个回答

clipboard.png
我的就是这样配置的 即可

撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题