fideloper / docker-nginx-php

An Ubuntu, Nginx and PHP stack Built in Docker
361 stars 142 forks source link

Problems with boot2docker / sendfile #17

Open nekaab opened 9 years ago

nekaab commented 9 years ago

Hi,

I wasted 3 hours on this, so maybe this helps someone:

Nginx was serving stale / old files, only solveable by restarting the boot2docker vm. I blamed nginx, apparently wrongly so.

After a lot of different approaches, I stumbled upon https://jeremyfelt.com/2013/01/08/clear-nginx-cache-in-vagrant/ . I changed the nginx.conf as such:

docker run --rm -t -i fbaaken/nginx-php /sbin/my_init -- bash -l
root@0e96ebfdb15b:/# vi /etc/nginx/nginx.conf
(Edited to sendfile off;)
(Committed container state to new image so to not lose changes)
(Ran from the new image from then on)

Hope this helps someone. I will keep the issue open, maybe there is a way to make this easier to configure when running the container so we can sue the same on in dev / prod environments when it's not running on a Virtualbox image (sendfile should be on in this case).

Best,

Felix

AnneTheAgile commented 9 years ago

ty @nekaab . This does indeed sound helpful, since it appears sendfile is such an important config [1]. AnneTheAgile 1.[] ; 2014-08; ; ; ;Nginx initial fame came from its awesomeness at sending static files. This has lots to do with the association of sendfile, tcp_nodelay and tcp_nopush in nginx.conf. ; ; ;Most articles dealing with optimizing Nginx performances recommend to use sendfile, tcp_nodelay and tcp_nopush options in the nginx.conf configuration file. Unfortunately, almost none of them tell neither how they impact the Web server nor how they actually work. ; ; X.Nginx Optimization: understanding sendfile, tcp_nodelay and tcp_nopush ; ; https://t37.net/nginx-optimization-understanding-sendfile-tcp_nodelay-and-tcp_nopush.html