nginx-未指定输入文件。 laravel应用程序

时间:2018-12-28 22:34:17

标签: 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;
        }

        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“

/ var / www / html / public /

中的

index.php

/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.

我遍历了每一行代码,但是没有找到任何东西,希望有人能看到问题。

谢谢。

1 个答案:

答案 0 :(得分:-1)

您可以验证/ var / www / html / public /中是否存在index.php。那是一个非标准的根。您还能验证用户nginx是否以有权访问该文件夹的身份运行

相关问题