PHP Excel 504 nginx timeout at 400 records. Not able to export the excel file
===

I am trying to export an excel file using PHP excel library. I can export about 400 records. However when I go for more about 600 records, I see nginx timeout error. I have been trying to resolve this issue. Does anyone know how to resolve this?

So far I have played with php options like.. set_time_limit(0); and ini_set('memory_limit','-1');

But still not able to resolve it.

Please help. Thanks in advance.