504 error Gateway Timeout

HI;

I’m using Nginx in a reverse proxy setup with Apache. I’m having a
problem when I submit a large upload via php; while Mogrify is
processing the photo upload, Nginx returns a 504 error - Gateway
Timeout.

I tried adding in proxy_read_timeout 600; proxy_send_timeout 600;, but
I am still having the same problem.

I’ve searched for answers for quite a few hours now, and am at a loss.
All of my PHP memory and time out settings are quite high.

It works when I do smaller uploads. It is the ones that take Mogrify
more than about 60 to 90 seconds to process that cause the error.
(uploads of over about 50 MB of images).

I was able to upload / process with this system prior to installing
Nginx. Please let me know if you want to see a copy of my config file
or any other information.

Thank You Kindly;

Jamie

This things should be fine. Please post your entire config.


Regards, Vitaly T.
System A.
U.S. +1 (206) 905-9939
Russia +7 911 094-2035

On Sat, Mar 19, 2011 at 1:49 PM, Vitaly T. [email protected] wrote:
This things should be fine. Please post your entire config.
Regards, Vitaly T.
System A.
U.S. +1 (206) 905-9939
Russia +7 911 094-2035

Thank You. This is my config file:

user nobody;

no need for more workers in the proxy mode

worker_processes 4;
error_log /var/log/nginx/error.log info;
worker_rlimit_nofile 20480;
events {
worker_connections 5120; # increase for busier servers
use epoll; # you should use epoll here for Linux kernels 2.6.x
}
http {
server_name_in_redirect off;
server_names_hash_max_size 2048;
server_names_hash_bucket_size 256;
include mime.types;
default_type application/octet-stream;
server_tokens off;
sendfile on;
tcp_nopush on;
tcp_nodelay on;
keepalive_timeout 60;
gzip on;
gzip_vary on;
gzip_disable “MSIE [1-6].”;
gzip_proxied any;
gzip_http_version 1.1;
gzip_min_length 0;
gzip_comp_level 6;
gzip_buffers 16 8k;

You can remove image/png image/x-icon image/gif image/jpeg if you

have slow CPU
gzip_types text/plain text/xml text/css application/x-javascript
application/xml image/png image/x-icon image/gif image/jpeg
application/xml+rss text/javascript application/atom+xml;
ignore_invalid_headers on;
client_header_timeout 3m;
client_body_timeout 3m;
send_timeout 3m;
reset_timedout_connection on;
connection_pool_size 256;
client_header_buffer_size 256k;
large_client_header_buffers 4 256k;
client_max_body_size 4M;
client_body_buffer_size 128k;
request_pool_size 32k;
output_buffers 4 32k;
postpone_output 1460;
proxy_temp_path /tmp/nginx_proxy/;
client_body_in_file_only on;
log_format bytes_log “$msec $bytes_sent .”;
include “/etc/nginx/vhosts/*”;
}

Regards;

Jamie

http {

proxy_read_timeout 600;
proxy_send_timeout 600;

server_name_in_redirect off;
server_names_hash_max_size 2048;
server_names_hash_bucket_size 256;

I added the above proxy read and proxy send lines. I had just
reinstalled this morning after doing some testing and accidentally
sent you the file without those added.

Thanks,

Jamie

Fine. But please note, this is only part of configuration. There are
some files regarding to directive:
/etc/nginx/vhosts/*

Please include them also.


Regards, Vitaly T.
System A.
U.S. +1 (206) 905-9939
Russia +7 911 094-2035

maybe is apache or php close the connection, for example exceed php max
file upload size or php max running time.

Posted at Nginx Forum:
http://forum.nginx.org/read.php?2,183412,184120#msg-184120

Fine. But please note, this is only part of configuration. There are some
files regarding to directive:
/etc/nginx/vhosts/*
Please include them also.

This is the vhost file for the site I am working on:

server {
error_log /var/log/nginx/vhost-error_log warn;
listen 173.255.200.107:80;
server_name pawdogs.com www.pawdogs.com;
access_log /usr/local/apache/domlogs/pawdogs.com-bytes_log
bytes_log;
access_log /usr/local/apache/domlogs/pawdogs.com combined;
root /home/pawdogs/public_html;
location / {
location
~..(3gp|gif|jpg|jpeg|png|ico|wmv|avi|asf|asx|mpg|mpeg|mp4|pls|mp3|mid|wav|swf|flv|html|htm|txt|js|css|exe|zip|tar|rar|gz|tgz|bz2|uha|7z|doc|docx|xls|xlsx|pdf|iso)$
{
expires 7d;
try_files $uri @backend;
}
error_page 405 = @backend;
add_header X-Cache “HIT from Backend”;
proxy_pass http://173.255.200.107:8081;
include proxy.inc;
}
location @backend {
internal;
proxy_pass http://173.255.200.107:8081;
include proxy.inc;
}
location ~ .
.(php|jsp|cgi|pl|py)?$ {
proxy_pass http://173.255.200.107:8081;
include proxy.inc;
}
location ~ /.ht {
deny all;
}

Thank You

Jamie

On 3/20/2011 10:21 PM, Jamie Dolan wrote:

include proxy.inc;


Regards, Vitaly T.
System A.
U.S. +1 (206) 905-9939
Russia +7 911 094-2035

Hi guys,

I have the exactly same issue.
What about include proxy.inc ?

Those are my values :
proxy_connect_timeout 90;
proxy_send_timeout 90;
proxy_read_timeout 90;
proxy_buffer_size 4k;
proxy_buffers 4 32k;
proxy_busy_buffers_size 64k;
proxy_temp_file_write_size 64k;

Use it with Magento on a VPS and always need to restart APACHE

Thanks for the help,

Antoine

include proxy.inc;
Regards, Vitaly T.

That was it! It’s all working now.

Thank You so much for your help.

Regards;

Jamie Dolan
Neenah, WI

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs