Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/280.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php nginx-未指定输入文件。拉维应用_Php_Linux_Laravel_Nginx - Fatal编程技术网

Php nginx-未指定输入文件。拉维应用

Php nginx-未指定输入文件。拉维应用,php,linux,laravel,nginx,Php,Linux,Laravel,Nginx,这是Ubuntu 16.04.4 LTS中的nginx配置文件: server { listen 80 default_server; root /var/www/html/public; index index.html index.htm index.php; server_name _; location / { try_files $uri $uri/ /index.php?$query_string;

这是Ubuntu 16.04.4 LTS中的nginx配置文件:

server {
    listen 80 default_server;

    root /var/www/html/public;
    index index.html index.htm index.php;
    server_name _;

        location / {
            try_files $uri $uri/ /index.php?$query_string;
        }

        location ~ \.php$ {

                fastcgi_pass unix:/var/run/php/site.com.sock;
                fastcgi_param SCRIPT_FILENAME 
                $document_root$fastcgi_script_name;
                include fastcgi_params;
                include snippets/fastcgi-php.conf;
        }

}
访问站点时,我得到:未指定输入文件

/var/run/php/site.com.sock存在:

root MainTest /var/run/php ls -la /var/run/php/
total 4
drwxr-xr-x  2 www-data www-data   80 Dec 28 19:22 .
drwxr-xr-x 27 root     root     1080 Dec 28 21:54 ..
srw-rw----  1 www-data www-data    0 Dec 28 19:22 site.com.sock
-rw-r--r--  1 root     root        5 Dec 28 19:22 php7.2-fpm.pid
这是/var/log/nginx/error.log

*7在stderr中发送的FastCGI:“无法打开主脚本:/var/www/html/public/index.php(没有这样的文件或目录)”,同时从上游读取响应头,客户端:xx.xxx.xx.xxx,服务器:\请求:“GET/HTTP/1.1”,上游:fastcgi://unix:/var/run/php/site.com.sock:,主机:“xxx.xx.xxx.xxx”

index.php在/var/www/html/public中/

/var/www/html/public$ ll
total 44
drwxrwxr--  3 www-data www-data 4096 Dec 28 21:49 ./
drwxrwxr-- 15 www-data www-data 4096 Dec 28 19:12 ../
drwxrwxr--  5 www-data www-data 4096 Dec 28 18:24 assets/
-rwxrwxr--  1 www-data www-data 5430 Dec 28 18:24 favicon.ico*
-rwxrwxr--  1 www-data www-data   53 Dec 28 18:24 google99e8c056471b6988.html*
-rwxrwxr--  1 www-data www-data  636 Dec 28 18:24 .htaccess*
-rwxrwxr--  1 www-data www-data 1823 Dec 28 20:12 index.php*
-rwxrwxr--  1 www-data www-data   24 Dec 28 18:24 robots.txt*
-rwxrwxr--  1 www-data www-data 5113 Dec 28 18:24 sitemap.xml*
nginx正在运行

root MainTest ~ service nginx status
● nginx.service - A high performance web server and a reverse proxy server
   Loaded: loaded (/lib/systemd/system/nginx.service; enabled; vendor preset: enabled)
   Active: active (running) since Fri 2018-12-28 21:54:07 UTC; 1h 4min ago
     Docs: man:nginx(8)
  Process: 29788 ExecStop=/sbin/start-stop-daemon --quiet --stop --retry QUIT/5 --pidfile /run/nginx.pid (code=exited, status=0/SUCCESS)
  Process: 29697 ExecReload=/usr/sbin/nginx -g daemon on; master_process on; -s reload (code=exited, status=0/SUCCESS)
  Process: 29798 ExecStart=/usr/sbin/nginx -g daemon on; master_process on; (code=exited, status=0/SUCCESS)
  Process: 29794 ExecStartPre=/usr/sbin/nginx -t -q -g daemon on; master_process on; (code=exited, status=0/SUCCESS)
 Main PID: 29801 (nginx)
    Tasks: 2
   Memory: 2.0M
      CPU: 31ms
   CGroup: /system.slice/nginx.service
           ├─29801 nginx: master process /usr/sbin/nginx -g daemon on; master_process on
           └─29802 nginx: worker process                           

Dec 28 21:54:07 MainTest systemd[1]: Starting A high performance web server and a reverse proxy server...
Dec 28 21:54:07 MainTest systemd[1]: nginx.service: Failed to read PID from file /run/nginx.pid: Invalid argument
Dec 28 21:54:07 MainTest systemd[1]: Started A high performance web server and a reverse proxy server.
我已经详细阅读了每一行代码,但没有发现任何东西,希望有人能看到这个问题


谢谢。

您能否验证/var/www/html/public/中是否有index.php。这是一个非标准的根。您还可以验证用户nginx是否正在运行,因为它可以访问该文件夹

Stack Overflow是一个用于编程和开发问题的站点。对于此问题,您应该使用上的另一个站点。