search by tags

for the user

adventures into the land of the command line

nginx-virtualbox weird behaviour with static files

if you’re using something like vagrant to do web dev stuff on your local machine and vagrant is using virtualbox, you might be interested to know that virtualbox doesn’t like something called sendfile

in the nginx config file, sendfile is on by default

$ sudo vim /etc/nginx/nginx.conf

http {
  include       /etc/nginx/mime.types;
  default_type  application/octet-stream;
  access_log  /var/log/nginx/access.log;
  sendfile    on;
  server_tokens on;

for some buggy reason, this causes static files to not be served by nginx, so for dev-ing, it helps to turn it off

one other thing you can do to make sure your static files are being served by nginx is to add this to your nginx server config

server {

    location /static {
        root /var/www/myapp;