'Laravel 504 Gateway Timeout if APP_ENV is not local under nginx

I am facing a strange error. We moved our Laravel 8 app from apache2 to nginx under Aws ELB load balancer. Now the problem is, if my APP_ENV value is production/testing, I am not able to log in to my app it shows 504 gateway timeout but if I change my APP_ENV to local, it is working fine.

I tested this multiple times but faced the same result. Can anyone help me out with this? TIA



Solution 1:[1]

There are several ways in which you can set the timeout for php-fpm. In /etc/php5/fpm/pool.d/www.conf I added this line request_terminate_timeout = 180 location ~ .php$ {fastcgi_pass unix:/var/run/php5-fpm.sock;fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;fastcgi_read_timeout 180;include fastcgi_params;}

Solution 2:[2]

You need to check Aws ELB load balancer timeout setting because php timeout setting can't override load balancer timeout setting.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Faran
Solution 2 ZIN