Dobrý den,
mám další problém s webserver Nginx na linux serveru. Při dlouhém importu mám chybu 504 Gateway Time-out. Prosím někoho o pomoc. Díky
CHYBA
------------------------
504 Gateway Time-out
nginx/1.18.0 (Ubuntu)
tail /var/log/nginx/error.log
------------------------
/var/run/php/php7.4-fpm.sock:", host: "192.168.17.2:8015", referrer: "http://192.168.17.2:8015/c/y" 2020/11/23 10:35:59 [error] 206255#206255: *22886 upstream timed out (110: Connection timed out) while reading response header from upstream, client: 192.168.4.21, server: , request: "GET /admin-import/bike HTTP/1.1", upstream: "fastcgi://unix:/var/run/php/php7.4-fpm.sock", host: "192.168.17.2:8015", referrer: "http://192.168.17.2:8015/admin"
ODPOVĚĎ
Dobrý den,
upravte konfiguraci Nginx + PHP - je třeba navýšit limity, zkuste navýšit v php.ini max_execution_time a max_input_time, dále v nginx virtualhostu fastcgi_read_timeout takto:
vim /etc/php/7.4/fpm/php.ini
................. ; Maximum execution time of each script, in seconds ; http://php.net/max-execution-time ; Note: This directive is hardcoded to 0 for the CLI SAPI max_execution_time = 300 ; Maximum amount of time each script may spend parsing request data. It's a good ; idea to limit this time on productions servers in order to eliminate unexpectedly ; long running scripts. ; Note: This directive is hardcoded to -1 for the CLI SAPI ; Default Value: -1 (Unlimited) ; Development Value: 60 (60 seconds) ; Production Value: 60 (60 seconds) ; http://php.net/max-input-time max_input_time = 180 ....................
vim /etc/nginx/sites-available/virtualhost.conf
server {
.................
fastcgi_buffers 16 32k;
fastcgi_buffer_size 64k;
fastcgi_busy_buffers_size 64k;
proxy_buffer_size 128k;
proxy_buffers 4 256k;
proxy_busy_buffers_size 256k;
fastcgi_read_timeout 180;
....................systemctl reload nginx;systemctl restart php7.4-fpm
Komentáře (0)
Přidat komentář