Vi Nguyen's Dev Notes
  • 📓Dev Notes
    • Buy me a coffee
  • Deployment & Operation
    • Docker Container
      • Add User to Docker Group
      • Clean up unused docker images
      • Backup Container
      • Truncate docker log
    • Git
    • Ansible
      • Ansible - Setup fresh new ubuntu server
      • Run Ansible Playbook on MacOS
    • Linux
      • Zip file with Gzip
      • Linux - add user to sudo group
      • Rsync - copy file on remote server to local
      • Tunnel all docker ports on remote server to localhost
      • Create linux Swapfile
      • Rename a file to folder name
      • Copy and keep permission on linux
    • Database
      • Check if database is reachable with nc
      • PostgreSQL
        • PostgreSQL - Create a new primary key auto-increment column
        • Generate uuid for all records in a table PostgreSQL
        • Backup & Import all database PostgreSQL Inside Docker Container
        • Backup & Import single database PostgreSQL Inside Docker Container
        • PostgreSQL - Create user & grant permission on a database
        • PostgeSQL - Backup database via remote ssh server
      • Mysql
        • Mysql - Create user & grant permission on a database
        • Dump & import Mysql database inside container
        • Mysql - Dump all Mysql database from Mysql
    • Ngnix
      • Nginx - 504 Gateway Timeout error using Nginx as Proxy
      • Download file from server via nginx docker
  • Docker-compose samples
    • docker-compose - n8n
    • docker-compose - PostgreSQL
    • docker-compose caddy as reverse proxy
  • Homelab
    • Rasberry Pi 4B - Bookworm HDMI config
    • Waveshare 3.5" display on Pi 4 -Bookworm 64 Bit
  • Development
    • Development Notes
  • My Resources
    • Blog
    • Geek Tools
    • Dev Note Github Repo
Powered by GitBook
On this page
  1. Deployment & Operation
  2. Ngnix

Nginx - 504 Gateway Timeout error using Nginx as Proxy

Nginx as Proxy for Web server, we can to try to fix the 504 Gateway Timeout error:

Add these variables to nginx.conf file:

  proxy_connect_timeout       600;
  proxy_send_timeout          600;
  proxy_read_timeout          600;
  send_timeout                600;

or add it to server block

server {
    location / {
        proxy_set_header   X-Real-IP $remote_addr;
        proxy_set_header   Host      $http_host;
        proxy_http_version 1.1;
        proxy_set_header Connection "";
        proxy_pass http://localhost:5000;
        proxy_connect_timeout       600;
        proxy_send_timeout          600;
        proxy_read_timeout          600;
        send_timeout                600;
    }
}

Then restart nginx:

service nginx reload

Last updated 1 year ago