Closed jujes closed 8 years ago
The log output that you really need when nginx returns an HTTP error code is the output from nginx itself. Everything else appears to be working fine. If you look at the nginx logs, you'll likely see what I did...
[error] 51#51: *5 upstream sent too big header while reading response header from upstream,
client: 192.168.99.1, server: reaction.dev, request: "GET / HTTP/1.1",
upstream: "http://172.17.0.5:80/", host: "reaction.dev"
Which means you need to increase the proxy buffer size in your nginx config. See this answer: http://stackoverflow.com/a/13896157/3129944
And optionally, read about what you're copy/pasting from that answer... http://nginx.org/en/docs/http/ngx_http_proxy_module.html http://nginx.org/en/docs/http/ngx_http_fastcgi_module.html
My recommendation is to build your own copy of jwilder/nginx-proxy
and inject the config changes at build time. See the custom config options in the nginx-proxy docs for how to do that.
Using the settings in the Stack Overflow answer proxy-wide would look like this in your custom nginx Dockerfile...
FROM jwilder/nginx-proxy:latest
RUN { \
echo 'fastcgi_buffers 4 256k;'; \
echo 'fastcgi_buffer_size 128k;'; \
echo 'fastcgi_busy_buffers_size 256k;'; \
} > /etc/nginx/conf.d/my_proxy.conf
RUN sed -i 's/^http {/&\n proxy_busy_buffers_size 256k;/g' /etc/nginx/nginx.conf && \
sed -i 's/^http {/&\n proxy_buffers 4 256k;/g' /etc/nginx/nginx.conf && \
sed -i 's/^http {/&\n proxy_buffer_size 128k;/g' /etc/nginx/nginx.conf
Then...
# build
docker build -t my-custom-nginx .
# run
docker run -d -p 80:80 -v /var/run/docker.sock:/tmp/docker.sock:ro my-custom-nginx
# run your docker-compose.yml
docker-compose up -d
proxy buffer size, successfully deployed!!! Thanks a lot @jshimko :+1: :100: :+1: After days trying the best way for run, with your advice it's done and work like a charm!
👍 Glad to hear it worked.
Thanks for the great work @jshimko ! 👍
My website runs is now running on liveoutthere.org on desktops, however, it doesn't show on iphones of iphone 6.
Any clues?
Also lesser important question here.
After build
# build docker build -t my-custom-nginx .
I just ran
docker run -d -p 80:80 -p 443:443 \ --name nginx-proxy \ -v /opt/certs:/etc/nginx/certs:ro \ -v /etc/nginx/vhost.d \ -v /usr/share/nginx/html \ -v /var/run/docker.sock:/tmp/docker.sock:ro \ my-custom-nginx
instead of
# run docker run -d -p 80:80 -v /var/run/docker.sock:/tmp/docker.sock:ro my-custom-nginx
# run your docker-compose.yml docker-compose up -d
It all works. But curious what's different?? They are the same right? it's simpler option right?
cheers
@Seunghunsh Your site loads fine for me on desktop and an iphone 6, so I'll assume you worked this out.
Also, this is more of a general deployment question and isn't really an issue with Reaction, so it would be better to post questions like this in the forum or the Gitter chat.
Incase anyone comes across this again. You could use my docker image willmoss1000/doreactioncommerce
instead of jrcs/letsencrypt-nginx-proxy-companion
. This adds the proxy buffers how @jshimko jshimko suggests above. All working for me now finally!
Actual Behavior
502 Bad Gateway --> nginx/1.9.15
Steps to Reproduce the Behavior
run nginx-proxy
docker run -d -p 80:80 -p 443:443 -v /etc/nginx/certs:/etc/nginx/certs -v /var/run/docker.sock:/tmp/docker.sock:ro jwilder/nginx-proxy
docker-compose.yml
docker-compose up -d
here logs for more info 46