Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

file_get_contents 504 gateway timeout after merging project to amazon EC2?

Checking out the project and the functionalities , I did recognize that file_get_contents for internal files doesn't work at all. It always give me the same error :

file_get_contents 504 gateway timeout

Can you help me to find out how to fix it?

like image 909
user3911183 Avatar asked Apr 23 '15 14:04

user3911183


People also ask

How do I fix my gateway timeout on AWS?

To resolve this: Modify the idle timeout for your load balancer so that the HTTP request completes within the idle timeout period. Modify your application to respond to the HTTP request faster. Make sure that the application doesn't take longer to respond than the configured idle timeout.

Is a 504 Gateway Timeout my fault?

The 504 Gateway error is usually temporary, and different reasons may cause it. Most often than not, the problem is due to a client-end issue like Internet connection troubles. However, the hitch may be due to server-to-server network connectivity issues or a server being down.


1 Answers

For Nginx server

Check that you are not running into worker depletion on the PHP side of things, I had face this issue too on my lab server setup which was configured to save RAM. Basically I forgot that you are using a single worker to process the main page been displayed to the end-user, then the get_file_contents() function is basically generating a separate HTTP request to the same web server, effectively requiring 2 workers for a single page load. As the first page was using the last worker there was none available for the get_file_contents function, therefore Nginx eventually replied with a 504 on the first page because there was no reply on the reverse proxy request.

like image 87
user3606755 Avatar answered Oct 25 '22 17:10

user3606755