nginx + php-fpm上的Laravel返回空白页

我遇到了nginx + php-fpm提供的Laravel问题,它只是返回一个空白页面。 nginx,php和laravel都没有logging任何错误。

当使用CLI运行index.php时,它将返回欢迎页面。

laravel栈未触及,所有错误报告/显示/日志logging打开。

下面是我的nginx虚拟主机:

server { listen 801; server_name _; root /path/to/laravel/public; index index.html index.html index.php; charset utf-8; gzip on; gzip_http_version 1.1; gzip_disable "MSIE [1-6]."; gzip_vary on; gzip_proxied expired no-cache no-store private auth; gzip_comp_level 9; fastcgi_buffers 8 16k; fastcgi_buffer_size 32k; fastcgi_read_timeout 180; # serve static files directly location ~* \.(jpg|jpeg|gif|css|png|js|ico|html)$ { access_log off; expires max; } location / { index index.html index.htm index.php; #try static .html file first ##try_files $uri $uri/ /index.php; <<Wrong!! this will break bundles like OneAuth for example try_files $uri $uri/ /index.php?q=$uri&$args; } # catch all error_page 404 /index.php; #set client_max_body_size client_max_body_size 25m; #set client_body_buffer_size client_body_buffer_size 128k; location ~ \.php$ { fastcgi_split_path_info ^(.+\.php)(/.+)$; fastcgi_pass unix:/var/run/php-fpm.sock; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; include fastcgi_params; } } 

我的问题是,应用程序/存储具有错误的权限。 所以,如果你得到和我一样的错误,空白页,尝试chmod 0777整个应用程序/存储文件夹。

 sudo chmod -R 0777 app/storage 

OP表示他的工作解决scheme是sudo chmod -R 0777 app/storage

虽然解决了这个问题, 但它永远不是解决scheme 。 正确的方法是将该组设置为www-data并赋予其写入权限。

 chown -R www-data app/storage chmod -R 0770 app/storage 

有关chmod 777Linuxnetworking服务器上的权限的详细说明请参阅此答案: 我的网站文件/文件夹在Linuxnetworking服务器上应拥有哪些权限?

尝试将您的'try_files'参数更改为以下内容:

 try_files $uri $uri/ /index.php?$args; 

我的问题是,应用程序/存储具有错误的权限。 所以,如果你得到和我一样的错误,空白页,尝试chmod 0777整个应用程序/存储文件夹。

 sudo chmod -R 0777 app/storage