Broken files when using Virtualbox synced folders and Nginx

In case if you noticed that static files that are served via nginx arrive broken somehow – check if you have the sendfile directive turned off

sendfile off;

since it looks like it currently is broken in Virtualbox

Advertisements

A quick way to switch ubuntu to use local mirrors

For the people who frequently configure new ubuntu machines (eg in Vagrant) this script may save some megabytes and minutes downloading software from a local mirror instead of default:

sed -i "/mirror:\\/\\//d" /etc/apt/sources.list
sed -i "1ideb mirror://mirrors.ubuntu.com/mirrors.txt trusty main restricted universe multiverse" /etc/apt/sources.list
sed -i "1ideb mirror://mirrors.ubuntu.com/mirrors.txt trusty-updates main restricted universe multiverse" /etc/apt/sources.list
sed -i "1ideb mirror://mirrors.ubuntu.com/mirrors.txt trusty-backports main restricted universe multiverse" /etc/apt/sources.list
sed -i "1ideb mirror://mirrors.ubuntu.com/mirrors.txt trusty-security main restricted universe multiverse" /etc/apt/sources.list

Replace trusty with your distribution name and you’re done