2

I'm having this issue with Laravel which is served by nginx + php-fpm, it's just returning a blank page. Neither nginx nor php nor laravel are logging any errors at all.

When running the index.php with the CLI, it will return the welcome page.

The laravel stack is untouched, all error reporting/displaying/logging is turned on.

Below is my nginx vhost:

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; } } 

My problem was that app/storage had the wrong permissions. So if you get the same errors as myself, blank page, try chmod 0777 the entire app/storage folder.

sudo chmod -R 0777 app/storage 
1
  • Did you try to log PHP error via configuration with FPM config catch_workers_output = yes option. just a reminder: you can use xtail for multiple log file such as xtail /var/log/* Commented Nov 4, 2014 at 17:11

3 Answers 3

3

OP stated that his working solution is sudo chmod -R 0777 app/storage.

While it solved the problem, it is never the solution. The proper way is set the group as www-data and give it write permission.

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

For details explanation about chmod 777 and permissions on a Linux webserver, see this answer: What permissions should my website files/folders have on a Linux webserver?

2
  • 2
    For Laravel 5 users, please note that the laravel/app/storage directory has changed location to laravel/storage. Commented Jan 31, 2016 at 9:15
  • centos 8 + remi php 7:3 not work Commented Dec 31, 2020 at 15:41
0

Try change your 'try_files' argument to the following:

try_files $uri $uri/ /index.php?$args; 
13
  • Tried, but sadly no change. Commented Jan 23, 2014 at 22:06
  • Have you definitely got 'display_errors' and 'error_reporting' set using php_admin_flag and php_admin_value in your PHP-FPM pool configuration? The Nginx configuration for Laravel is really quite basic, as long as you're not using a sub-directory. Commented Jan 23, 2014 at 22:09
  • the phpinfo() returns: display_errors On, display_startup_errors On. So i guess it should be working Commented Jan 23, 2014 at 22:10
  • Try setting these in your PHP-FPM pool configuration file: php_admin_flag[display_errors] = on (and) php_admin_value[error_reporting] = E_ALL (split them on their own lines, and remove the 'and'). Make sure you restart the 'php-fpm' service and then try again. Commented Jan 23, 2014 at 22:11
  • Didnt help the reporting. This my current pool.conf file: pastebin.com/mc6P0PDy Commented Jan 23, 2014 at 22:16
0

My problem was that app/storage had the wrong permissions. So if you get the same errors as myself, blank page, try chmod 0777 the entire app/storage folder.

sudo chmod -R 0777 app/storage 

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.