Support » Plugin: Fast Velocity Minify » Error 504 gateway time-out
Error 504 gateway time-out
-
In General, a problem appears: 504 gateway time-out.
The site not loading, admin works, site no.
Deactivate the plugin then everything works.WP 4.8
The Fastcgi nginx + PHP-FPM 7.1.3
-
Hi, first this is what error 504 means:
The 504 Gateway Timeout error is an HTTP status code that means that one server did not receive a timely response from another server that it was accessing while attempting to load the web page or fill another request by the browser.
And here are some solutions:
https://stackoverflow.com/questions/16002268/prevent-nginx-504-gateway-timeout-using-php-set-time-limit—
Now, why it happens when you enable the plugin?
a) Check your php-fpm logs, if there is an error on wordpress, it will be shown there (not on nginx).
b) Nginx is a reverse proxy, so it doesn’t know about any errors. It only replies with 504 because php took too long to reply, saying “here’s the page you want”.
c) If NGINX timeout settings are too low and PHP processing is slow, it can happen.
d) Your wordpress site could have run out of memory when adding the plugin, and in that case it will die and nginx will not get a response.
e) Your php settings might be blocking output buffering or some other functions on the plugin (again, you need to see the php logs).
f) Does the error 504 occur right after enabling the plugin, and does it happen both on the frontend AND wp-admin? You may be missing some php extensions too, such as mcrypt, mb_string, etc.
g) If you have some other plugins trying to do speed optimization, they may conflict with this one. You should only use one type of plugin to achieve the same thing, ex: this one for minification and W3 Total Cache for cache (with minification disabled). Also bare in mind, nginx needs specific rules for W3 Total Cache to work properly (or you can use the Nginx Helper plugin for microcache… but still need changes on nginx.conf)
h) Enable the wp_debug log https://codex.wordpress.org/Debugging_in_WordPress
—-
Seems to me, that you are either running out of memory, having some other optimization plugins (some other plugin) conflicting, or something is off with your server configuration.
It may look like it’s the plugin fault, but if it’s a plugin conflict it would work if you disable it too (and then the error would occur when you enable that other plugin).I basically only use the LEMP Stack and it works perfectly, so just make sure it’s properly configured (php and nginx).
If you manage your own servers installation and administration, you may want to take a look at runcloud.io (it will make things easier).And here’s a list of php extensions that I use for PHP 7 on Debian:
php7.0-cli php7.0-common php7.0-curl php7.0-fpm php7.0-gd php7.0-gmp php7.0-imagick php7.0-imap php7.0-intl php7.0-json php7.0-mcrypt php7.0-memcached php7.0-mysql php7.0-opcache php7.0-pgsql php7.0-recode php7.0-redis php7.0-tidy php7.0-xmlrpc php7.0-xsl php7.0-xml php7.0-zip php7.0-mbstring php7.0-bcmathAs for nginx.conf, these settings are ideal:
# config types_hash_max_size 2048; server_tokens off; fastcgi_read_timeout 3600; keepalive_timeout 20s; keepalive_requests 100; reset_timedout_connection on; client_body_timeout 100; client_header_timeout 100; send_timeout 600; tcp_nodelay on; tcp_nopush on; sendfile on; sendfile_max_chunk 1024k; directio 100m; client_max_body_size 100m; server_names_hash_bucket_size 100; charset UTF-8; # important fastcgi_buffering on; fastcgi_buffer_size 128k; fastcgi_buffers 16 256k; fastcgi_busy_buffers_size 256k;For PHP, I recommend setting it to use a TCP port, instead of a socket.
A file socket, will start showing error 502 randomly, when you have too many visitors on the site… hence TCP is the correct way to do it for high load.My nginx fastcgi settings, on nginx:
# basic php params fastcgi_pass php; fastcgi_index index.php; fastcgi_keep_conn on; fastcgi_connect_timeout 600s; fastcgi_send_timeout 3600s; fastcgi_read_timeout 3600s; fastcgi_cache_lock on; fastcgi_cache_use_stale timeout updating; add_header X-Proxy-Cache $upstream_cache_status; # fast cgi params include fastcgi_params; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; fastcgi_param SCRIPT_NAME $fastcgi_script_name; fastcgi_param QUERY_STRING $query_string; fastcgi_param REQUEST_METHOD $request_method; fastcgi_param CONTENT_TYPE $content_type; fastcgi_param CONTENT_LENGTH $content_length; fastcgi_param REQUEST_URI $request_uri; fastcgi_param DOCUMENT_URI $document_uri; fastcgi_param DOCUMENT_ROOT $document_root; fastcgi_param REMOTE_ADDR $remote_addr; fastcgi_param REMOTE_PORT $remote_port; # geoip from cloudflare fastcgi_param HTTP_CF_IPCOUNTRY $http_cf_ipcountry;Let me know if any of these helps.
Because each server and each configuration might be different, I cannot be sure exactly what the issue is.
If you have a staging or some subdomain you can install on the server, feel free to test the plugin using a fresh wordpress installation.One last thing…
Try to disable HTML minification and see if it works.
If it does, your server is blocking the php output buffering.
- You must be logged in to reply to this review.