http – Nginx showing 504 Gateway timed out when uploading large files

I have a simple PHP file upload script that uploads a file. The server consists of 1 nginx reverse proxy and another nginx server (upstream). The problem is that when I try to upload very large files ~ 2GB then I get an error:

504 Gateway Time-out

Here is my reverse proxy configuration:

server {
    listen 80;
    
    server_name upload.mycloudhost.com;

    proxy_buffer_size 1024k;
    proxy_buffers 4 1024k;
    proxy_busy_buffers_size 1024k;
    proxy_connect_timeout       600;
    proxy_send_timeout          600;
    proxy_read_timeout          600;
    send_timeout                600;
    client_body_timeout         600;
    client_header_timeout       600;
    keepalive_timeout           600;
    uwsgi_read_timeout          600;

    location / {
        proxy_set_header X-Real-IP  $remote_addr;
        proxy_set_header X-Forwarded-For $remote_addr;
        proxy_set_header Host $host;
        proxy_pass http://localhost:13670;
    }
}

And here is the other nginx server (upstream):

server {
    listen 80;
    
    server_name upload.mycloudhost.com;

    client_max_body_size 80G;
    proxy_buffer_size 1024k;
    proxy_buffers 4 1024k;
    proxy_busy_buffers_size 1024k;
    proxy_connect_timeout       600;
    proxy_send_timeout          600;
    proxy_read_timeout          600;
    send_timeout                600;
    client_body_timeout         600;
    client_header_timeout       600;
    keepalive_timeout           600;
    uwsgi_read_timeout          600;

    root /var/www/mycloudhost;
    index index.php index.html index.htm index.nginx-debian.html;

    location ~ .php$ {
        try_files $uri =404;
        fastcgi_split_path_info ^(.+.php)(/.+)$;
        fastcgi_pass php:9000;
        fastcgi_index index.php;
        include fastcgi_params;
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
        fastcgi_param PATH_INFO $fastcgi_path_info;
    }

    location / {
        try_files $uri $uri/ =404;
    }
}

NGINX Custom Error page for 504 timeout not working

Some of a server operation can be slow and cause a nginx 504 timeout. I am trying to add a custom error page for 502,504 errors but nginx always shows the default error page.

Here is my config

server {
  listen 443 ssl;
  server_name falsename.name.com
  ssl_certificate path_to_cert;
  ssl_certificate_key path_to_key;
  error_page 502 504 /errors/custom_504.html;
  location /errors/ {
    autoindex on;
    root /usr/share/nginx/html;
    try_files $uri /errors/404.html;
  }
  location / {
  error_page 502 504 /errors/custom_504.html;
  proxy_pass https://10.0.0.190:9912;
  proxy_pass_request_headers on;
  proxy_set_header Host $host;
  proxy_set_header X-Real-IP $remote_addr;
  proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
  proxy_set_header X-Forwarded-Proto https;
  proxy_set_header Connection "";
  proxy_http_version 1.1;
  }
}


performance – 504 Error on WooCommerce Checkout but only when Cron Fires

I am having an issue where, on a site utilizing WooCommerce, handling a few thousand orders per day, users will experience a 504 Timeout error on wc-ajax=checkout, but only when the WordPress Cron has just started executing (i.e. if the user happens to click the Submit Order button at 0:01-0:04 seconds after the cron job starts). The user’s request times out 60 seconds later per our Apache configuration.

The order actually goes through successfully to the payment gateway (Authorize.NET) and the customer receives an email receipt, but the checkout screen shows no error once the mask disappears so the customer clicks “Submit Order” again and this results in duplicate orders.

This is an example of the error but that’s about all I get that is helpful.

(Sat Nov 28 15:41:04 2020) (proxy_fcgi:error) (pid 30570:tid 140163472602880) (70007)The timeout specified has expired: (client 108.162.246.114:36056) AH01075: Error dispatching request to : (polling), referer https://example.com/checkout

I have added define('DISABLE_WP_CRON', true) and have our Cron running once every five minutes.

What I have tried/checked:

  1. I went though each process listed in wp cron event list and ran them manually via the CLI and did not notice any processes that took exceptionally long (the max was 0.4s — most were far shorter).

  2. I have tried increasing the number of PHP-FPM Processes from 5 to 25 as there is plenty of CPU and RAM capacity available on the server, but this doesn’t seem to make much of a difference, nor do I see evidence of a spike when the cron runs.

pm                         = ondemand
pm.max_children            = 25
pm.max_requests            = 200

Most traffic is offloaded to Cloudflare so for the most part, the server is handling admin tasks, the cart, checkout & cron.

My guess is that for those particular seconds, the cron and checkout are competing for resources and this the cause of the issue though I don’t understand why, the user’s request would run for a minute an then timeout or why increasing the number of children doesn’t seem to make much of

  1. Does anyone have any other good ideas on how to debug the issue?
  2. Is there any way to somehow limit the resources that the cron uses or perhaps a better way than simply hitting https://example.com/wp-cron.php via an HTTP request

504 – HAProxy caches connection error?

We have a backend service currently served in front of a HAProxy proxy server for load balancing.

When we shut down the backend service for maintenance, client connecting to the HAProxy is receiving 504-Gateway Timeout error, which is expected.

However when the backend service is up, the client continue to receive the 504 status code, well into the next day after.

Client is connecting via a connection pool, using Spring RestTemplate and Apache HTTPClient.

After client is restarted, the problem goes away. Is there any configuration in HAProxy that caches the connection? Any configuration that we can do to prevent this issue?

Note that if try manually using curl command, the request can reach the backend without issue.

Thank you.

504 Gateway Time-out after custom plugin inserts data into mysql database

I have a custom plugin that inserts multiple rows into a custom table in the wordpress database. After about 50 seconds I get a 504 Gateway Time-out error. The 50 seconds is around about the time it takes to insert ~400 rows. Anything less, and the script completes just fine.

I’ve added the usual things to wp-config.php and .htaccess

wp-config.php

ini_set('max_execution_time', 1000);
ini_set('max_input_time', 1000);
set_time_limit(1000);

.htaccess

php_value memory_limit 256M
php_value upload_max_filesize 64M
php_value post_max_size 64M
php_value max_execution_time 1000
php_value max_input_time 1000

…but none of these seem to make any difference. The script always timeout after about 50 seconds and I get 504 Gateway Time-out The server didn't respond in time error screen.

My code:

global $wpdb;
$table = 'wp_motorjobs_jobs';
$insert_data = array();

Then I do a foreach loop where I prepare my data based on some other conditions. I end up with this array structure towards the end of the loop:

$job_data = array(
   'title' => $job_title,
   'company' => $job_company,
   'location' => $job_location,
   'type' => $job_type,
   'details' => $job_details,
   'query' => $search_query,
   'site' => $job_site,
   'url' => $url,
   'date' => $job_date
);                  
                
array_push($insert_data, $job_data);

Then I end my loop. This loop could have added hundreds of arrays to $insert_data. All the data are strings.

Then I prepare my sql query:

$query = "INSERT INTO $table ( title, company, location, type, details, query, site, url, date ) VALUES ";
            
foreach ( $insert_data as $row ) {
   $query .= $wpdb->prepare( "(%s, %s, %s, %s, %s, %s, %s, %s, %s),", $row('title'), $row('company'), $row('location'), $row('type'), $row('details'), $row('query'), $row('site'), $row('url'), $row('date') );
}

$query = rtrim( $query, ',' ) . ';';

$wpdb->query($query);

After this script runs for about 50 seconds I get the 504 Gateway Time-out

Anyone? Cheers.

Proxy Service Socks5 Cheap Socks5

SOCKS Proxy List by Tisocks.net
If you need socks5, please visit the service and add funds through PM, BTC WMZ. Thank you all!!
Add background: https://tisocks.net/addfund
Check socks5 online here: https://checksocks5.com
Live | 171.212.91.216:38801 | 2,214 | SOCKS5 | Sichuan | Unknown | China Telecom | China | Reviewed at https://tisocks.net
Live | 114.103.88.5:38801 | 1,504 | SOCKS5 | Zhejiang | Unknown | China Telecom | China | Reviewed at https://tisocks.net
Live | 112.84.210.252:38801 | 1,216 | SOCKS5 | Jiangsu | Unknown | China Unicom Liaoning | China | Reviewed at https://tisocks.net
Live | 101.206.115.109:38801 | 1,267 | SOCKS5 | Sichuan | Unknown | China Unicom Liaoning | China | Reviewed at https://tisocks.net
Live | 183.166.232.30:38801 | 4,821 | SOCKS5 | Anhui | Unknown | China Telecom | China | Reviewed at https://tisocks.net
Live | 49.87.100.166:38801 | 2.96 | SOCKS5 | Jiangsu | Unknown | China Telecom | China | Reviewed at https://tisocks.net
Live | 49.88.220.185:38801 | 6,376 | SOCKS5 | Jiangsu | Unknown | China Telecom | China | Reviewed at https://tisocks.net
Live | 218.2.60.66:38801 | 1,923 | SOCKS5 | Jiangsu | Unknown | The | China | Reviewed at https://tisocks.net
Live | 114.237.59.219:38801 | 2,084 | SOCKS5 | Unknown | Unknown | 219.59.237.114.broad.lyg.js.dynamic.163data.com.cn | China | Reviewed at https://tisocks.net
Live | 60.182.75.5:38801 | 2,105 | SOCKS5 | Unknown | Unknown | The | Unknown | Reviewed at https://tisocks.net
Live | 60.182.127.88:38801 | 1,021 | SOCKS5 | Zhejiang | Unknown | 88.127.182.60.broad.jh.zj.dynamic.163data.com.cn | China | Reviewed at https://tisocks.net
Live | 220.170.242.12:38801 | 2,888 | SOCKS5 | Hunan Unknown | China Telecom | China | Reviewed at https://tisocks.net
Live | 184.168.146.10:4319 | 3,372 | SOCKS5 | Unknown | Unknown | ip-184-168-146-10.ip.secureserver.net | United States | Reviewed at https://tisocks.net
Live | 117.60.42.129:38801 | 1,084 | SOCKS5 | Jiangsu | Unknown | 129.42.60.117.dial.xz.js.dynamic.163data.com.cn | China | Reviewed at https://tisocks.net
Live | 115.209.119.29:38801 | 1,757 | SOCKS5 | Zhejiang | Unknown | China Telecom | China | Reviewed at https://tisocks.net
Live | 153.99.5.33:38801 | 4,211 | SOCKS5 | Jiangsu | Unknown | China Unicom Liaoning | China | Reviewed at https://tisocks.net

tisocks
reviewed by tisocks in
.
[Tisocks.net] – Socks5 Proxy Service Cheap Socks5
SOCKS Proxy List by Tisocks.net
If you need socks5, please visit the service and add funds through PM, BTC WMZ. Thank you all!!
Add background: https://tisocks.net/addfund
Check socks5 online here: https://checksocks5.com
Live | 171.212.91.216:38801 | 2,214 | SOCKS5 | Sichuan | Unknown | China Telecom | China | Reviewed at https://tisocks.net
Live | 114.103.88.5:38801 | 1,504 | SOCKS5 | Zhejiang | Unknown | China Telecom | China | Reviewed at https://tisocks.net
Live | 112.84.210.252:38801 | 1,216 |

Classification: 5 5

.

Docker + Django + Nginx Random Flashing 504

I am working on containing a Django application with Docker, but I have many problems for the application to run consistently. My settings below:

Dockerfile

FROM ubuntu:18.04

RUN apt-get update -y
RUN apt-get upgrade -y

RUN apt-get install -y 
        nginx 
        git 
        python3 
        python3-dev 
        python3-pip 
        build-essential 
        libpq-dev 


RUN apt-get install postgresql-client -y

RUN mkdir /config

COPY requirements.txt /config/

RUN pip3 install --no-cache-dir -r /config/requirements.txt

COPY wait-for-postgres.sh /config/

RUN chmod +x /config/wait-for-postgres.sh

RUN mkdir /src

COPY ./src /src

WORKDIR /src

docker-compose.yml

version: '3'

services:
  db:
    image: postgres:9.5
    container_name: pg01
    environment:
      POSTGRES_PASSWORD: dusk
  web:
    build: .
    command: ("/config/wait-for-postgres.sh", "db", "python3", "manage.py", "runserver", "0.0.0.0:8000")
    expose:
      - "8000"
    depends_on:
      - db
      - nginx
    container_name: dj01
    environment:
      POSTGRES_PASSWORD: mypass
      PGPASSWORD: mypass
      PGHOST: postgres
      PGPORT: 5432
  nginx:
    image: nginx:latest
    container_name: ng01
    ports:
      - "8000:8000"
    volumes:
      - ./config/nginx:/etc/nginx/conf.d
      - ./src/static:/static

nginx.conf

upstream web {
  ip_hash;
  server web:8000;
}

server {

    location /static/ {
        autoindex on;
        alias /static/;
    }

    location / {
        proxy_pass http://web/;
    }
    listen 8000;
    server_name localhost;
}

I am running the application with docker-compose up --build and about 95% of the time I get a 504 timeout. The other 5% of the time the application loads. Sometimes, remove the containers completely with docker rm $(docker ps -a -q) and building from scratch causes the application to load, but not consistently.

When the application runs, it works as expected, but the changes I make are not consistently reloaded live. This will often force me to manually restart the application (ctrl+c Y docker-compose up --build again), which often returns me to error 504.

What am I doing wrong here?

NGINX Dual Reverse Proxy Slow Charge / Standby Time (504)

I have an application that runs on a local virtual machine. In a second virtual machine nginx is running as a reverse proxy for this application. Accessing the application directly or through the local reverse proxy works fine.
Then there is a second reverse proxy running on a DC, because my local machines only have public IPv6.

The problem:
Accessing the service through the proxy in DC has really slow loads or 504 timeouts most of the time. However, the client connection to the DC nginx installation is working fine (this nginx is also serving a small local html file, working as intended).

Both servers use TLS only with valid certificates (I want encrypted traffic between the Proxies). The connection between the two servers managed 180 MBit / s (average) in Iperf with a 4-5 ms ping.

So my configuration looks like

| Application VM | <-IPv4 / 6- | NGINX local proxy |
<-IPv6- | Proxy DC NGINX | <-IPv4 / 6- | Customer |

Any help would be really appreciated, I am without ideas

NGINX local

server  {

        client_max_body_size 2000M;
        client_body_buffer_size 2000M;
        listen 443 ssl default_server;
        listen (::):443 ssl default_server;
        ssl_certificate /etc/letsencrypt/live/domain.eu/fullchain.pem;
        ssl_certificate_key /etc/letsencrypt/live/domain.eu/privkey.pem;
        server_name _;
        ssl_session_cache shared:SSL:1m;
        ssl_session_timeout 1h;
        add_header Strict-Transport-Security "max-age=17280000 ; preload";
        location / {
                proxy_set_header Host $host;
                proxy_intercept_errors on;
                proxy_connect_timeout 10;

                proxy_pass http://aiz.domain.eu:3000;
        }

        error_page 501 502 503 504 /500.html;
        location /500.html {
                root /var/www/html/error;
        }

        error_page 404 /404.html;
        location /404.html      {
                root /var/www/html/error;
        }

}

DC NGINX

server {

        listen 443 ssl default_server;
        listen (::):443 ssl default_server;
        ssl_certificate /etc/letsencrypt/live/domain.eu/fullchain.pem;
        ssl_certificate_key /etc/letsencrypt/live/domain.eu/privkey.pem;
        server_name _;
        ssl_session_cache shared:SSL:1m;
        ssl_session_timeout 1h;
        location / {
                proxy_set_header Connection "";
                proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
                proxy_set_header X-Real-IP $remote_addr;
                proxy_set_header Host $host;
                proxy_pass https://haruhime.domain.eu;
                proxy_intercept_errors on;
        }

        error_page 504 /504.html;
        location /504.html {
                root /var/www/error;
        }

}

server {
        listen 80 default_server;
        listen (::):80 default_server;
        server_name _;
        return 301 https://$host$request_uri;
}

Small note:
haruhime.domain.eu is an AAAA record of my local NGINX
aiz.domain.eu is an AAAA of the application (a git)

amazon web services – ALB Gateway time-out 504

I implemented an application in EKS. I am using the Ingress controller with ALB. The status check of this load balancer has the status Request Timeout. When I visit the DNS of the load balancer, the web application page does not load. I see 504 Gateway Time-out.

I tried some suggestions online, for example, increasing the load balancer timeout, but it didn't help. The security groups are fine.

Any ideas?

Plug-in update error – & # 39; Installation error: 504 Gateway timeout 504 Gateway timeout nginx / 1.15.8 & # 39; Error message

I was using the add-on & # 39; The Events Calendar & # 39; On a website, the add-on seemed to be removed randomly and a php error message was displayed.

Now, when I try to reinstall the add-in, I receive an error message "update failed" and the following text:

"Installation error: 504 Gateway timeout 504 Gateway timeout nginx / 1.15.8"

When I enter FTP, the add-in folder still exists within the backend. I've spent years adding events to the calendar before it broke.

How can i solve this problem? Concerned about deleting the folder since I don't want to lose the event data.

My site is www.wheatfen.org and webhost is Fasthosts (DO NOT use them as they are shocking).

Thank you.

screenshot of the error message