I just recently switched from Apache to Nginx and everything seemed to be going well. However, while testing a PunBB site that I brought over, I got a 502 Bad Gateway error when trying to make a post. The strange thing was, the behavior was inconsistent. I could post in some threads, but not others. A bit of googling turned up this page and the suggestion there worked for me.
Looks like the default header limits on Nginx were too small for my site, so I added these two lines to my nginx.conf:
[note color=”#DDD”]/etc/nginx/nginx.conf
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
[...] http { ## # Basic Settings ## # Setting up a zone to limit repeated search requests # Learned the hard way that I had to put this before any includes limit_req_zone $binary_remote_addr zone=one:10m rate=1r/s; sendfile on; tcp_nopush on; tcp_nodelay on; keepalive_timeout 65; types_hash_max_size 2048; server_tokens off; fastcgi_buffer_size 16k; fastcgi_buffers 4 16k; # server_names_hash_bucket_size 64; # server_name_in_redirect off; include /etc/nginx/mime.types; default_type application/octet-stream; ## # Logging Settings ## [...] } |
I could have just added them to that site’s config, but it’s not the only forum site I run, so I figured I’d just make it a global setting.