简体   繁体   中英

Laravel 5 shows blank page on server but works locally

I'm having an issue since today when I uploaded updates to my production server from my local development environment on my laptop.

When I try to access a page, it's completely blank. I didn't touch anything - I did like I always do when uploading new files, which has always worked.

I can also access my assets, like images, js and css perfectly fine. And my auth middleware is working as I'm using Steam login and it redirects me to login through Steam.

What I remember doing before it broke:

  • Uploaded my files
  • ran composer dumpautoload
  • ran php artisan cache:clear

What I have done so far:

  • Checked my NGINX/PHP/MySQL error logs. Nothing.
  • Checked laravel logs, nothing there either.
  • Made sure PHP, NGINX and Mysql is running.
  • Made sure php, nginx and mysql is up to date.
  • Generated a new key
  • Double checked my .env so it's valid.
  • composer update
  • chmodded my directories (even though I had no problems with this prior to the blank page).

At this point I don't know how and why it suddenly does not work, when it's working perfectly fine on my local laptop.

nginx config:

server {
    listen 80 default_server;
    listen [::]:80 default_server;
    server_name example.com;

    proxy_set_header X-Forwarded-For $remote_addr;

    return 301 https://$server_name$request_uri;
}

server {
    listen 443 ssl http2;
    listen [::]:443 ssl http2;

    root /var/www/preview/example/public;

    add_header X-Frame-Options "SAMEORIGIN";
    add_header X-XSS-Protection "1; mode=block";
    add_header X-Content-Type-Options "nosniff";

    charset utf-8;

    index index.html index.htm index.php;

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

    location = /favicon.ico { access_log off; log_not_found off; }
    location = /robots.txt  { access_log off; log_not_found off; }

    location ~ \.php$ {
        fastcgi_pass unix:/var/run/php/php7.2-fpm.sock;
        fastcgi_index index.php;
        fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name;
        include fastcgi_params;

        #auth_basic "Restricted Content";
        #auth_basic_user_file /etc/nginx/.htpasswd;
    }

    location ~ /\.(?!well-known).* {
        deny all;
    }

    server_name hsbuilds.com;
    ssl    on;
    ssl_certificate /home/hsbuilds/src/hsbuilds/example.com.chained.crt;
    ssl_certificate_key /home/hsbuilds/src/example.com/example.com.key;

    ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
    ssl_prefer_server_ciphers on;
    ssl_ciphers 'EECDH+AESGCM:EDH+AESGCM:AES256+EECDH:AES256+EDH';

    #location / {
    #   proxy_pass http://example.com:8000;
    #   proxy_set_header X-Forwarded-For $remote_addr;
    #}
}

Edit: When checking the network tab in chrome, the page returns code 200.

first, check .env file and especially vars APP_KEY (php artisan key:generate) and APP_URL .

Then run, just for sure php artisan cache:clear && php artisan config:clear && php artisan config:cache .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM