Consider that importing logs will take more time than a typical web request given the size of the log to process. If you import daily then, the server must be able to process the size of log produced without timing out in NGINX or in the FastCGI PHP server.
Most default configurations have modest values for timeouts, the server has to be specifically allowed to let a process run longer and use more memory.
Adjust the timeouts to a higher threshold for NGINX and PHP FastCGI, if set really high and the import still fails there is some other problem
NGINX vhost config for piwik
# set this value high so
fastcgi_read_timeout 14400; # 4 hrs
http://nginx.org/en/docs/http/ngx_http_fastcgi_module.html#fastcgi_read_timeout "Defines a timeout for reading a response from the FastCGI server."
By setting this high we can ensure NGINX will wait long enough for the processing to complete in order to get a response.
FastCGI / PHP pool config for piwik
; make sure php can log errors if something is wrong
php_admin_flag[log_errors] = on
php_admin_value[error_log] = </path/to/log>
; set to something reasonable, make sure there are no out of memory errors in log otherwise increase value with respect to server's ram
php_admin_value[memory_limit] = 512M
; set these values high, 1 hr
php_admin_value[max_execution_time] = 3600
php_admin_value[max_input_time] = 3600
You should read and understand NGINX's configuration as well as for PHP FastCGI.
Most default configurations have modest values for timeouts, the server has to be specifically allowed to let a process run longer and use more memory.
Adjust the timeouts to a higher threshold for NGINX and PHP FastCGI, if set really high and the import still fails there is some other problem
NGINX vhost config for piwik
# set this value high so
fastcgi_read_timeout 14400; # 4 hrs
http://nginx.org/en/docs/http/ngx_http_fastcgi_module.html#fastcgi_read_timeout "Defines a timeout for reading a response from the FastCGI server."
By setting this high we can ensure NGINX will wait long enough for the processing to complete in order to get a response.
FastCGI / PHP pool config for piwik
; make sure php can log errors if something is wrong
php_admin_flag[log_errors] = on
php_admin_value[error_log] = </path/to/log>
; set to something reasonable, make sure there are no out of memory errors in log otherwise increase value with respect to server's ram
php_admin_value[memory_limit] = 512M
; set these values high, 1 hr
php_admin_value[max_execution_time] = 3600
php_admin_value[max_input_time] = 3600
You should read and understand NGINX's configuration as well as for PHP FastCGI.