1

I keep getting 504 gateway time out error on nginx php7.0 ubuntu 16.04 for my laravel 5.3 website.

My suspicion whereHas query is the problem. When I commented out the query, it seems working fine. the query

Item::with('image', 'brand', 'currency')->where('display', '>=', 3)->whereHas('catitems', function($query){
                $query->where('catitems.id', 5);
            })->inRandomOrder()->take(6)->get();

any idea whats wrong here?

my vultr vps spec is 1GB RAM, 1 Core.

This is the error log

recv() failed (104: Connection reset by peer) while reading response header from upstream

this is my buffer config

fastcgi_buffers 8 128k;
fastcgi_buffer_size 128k;

Any idea how to solve this?

Tom Kur
  • 2,248
  • 1
  • 18
  • 28
  • If it is literally timing out, then you could try limit your `whereHas` query with `->take(5)` and see if that works. Otherwise, you can increase the PHP timeout with `max_execution_time = 60 ; also, higher if you must - sets the maximum time in seconds` (credit to this [answer](https://stackoverflow.com/a/3829437/2053706)) – Ari Aug 02 '18 at 02:26
  • The query does have take(6). I edited the question with the query. and my current max_execution_time = 5000, still timed out. – Tom Kur Aug 02 '18 at 03:25

0 Answers0