I have 2 RoR web applications hosted on 2 different servers. For one particular page, the request is served from the second application. For rest of the pages, the request i
proxy_set_header Connection keep-alive;
Full config
server {
listen 0000; #//port give by your need
server_name aa.com;
proxy_buffers 16 4k;
proxy_buffer_size 2k;
#charset koi8-r;
#access_log logs/host.access.log main;
location ~ ^/hello/{
proxy_buffering off;
proxy_pass http://127.0.0.1:1111; #//port give by your need
proxy_redirect off;
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 Connection keep-alive;
}
You might want to check if the user that is running the Nginx worker owns the directory /var/lib/nginx
.
I've learned that when you give a response too big for Nginx, it uses this directory to write as a working directory for temporary files. If the worker process cannot access it, Nginx will terminate the transmission before it completes, thus the error INCOMPLETE_CHUNKED_ENCODING.
For me, the solution was what DfKimer recommended, but instead of /var/lib/nginx
it was /var/cache/nginx
.
I got this error due to server memory full. hope this helps any one in future.
If proxied server cannot write to /var/lib/nginx
, yo do not need to play with file permissions or ownership of that directory. You can change the cache directory of nginx for the context by;
proxy_temp_path /home/emre/projects/frontend/nginx_temp 1 2;
inside http
, server
or location
contexts of nginx.conf
file.
check http://nginx.org/en/docs/http/ngx_http_proxy_module.html#proxy_temp_path
Bumped into this issue on AWS and found that adding a few proxy_buffer directives to the site config file fixed the issues:
server {
...
location / {
...
proxy_buffers 8 1024k;
proxy_buffer_size 1024k;
}
}