For a single VVV site pulling images from its live counterpart , this works great. It will pull images and other files from a live site to display in your dev env.
# Directives to send expires headers and turn off 404 error logging. location ~* .(js|css|png|jpg|jpeg|gif|ico|mp3|mov|tif|tiff|swf|txt|html)$ { expires 24h; log_not_found off; try_files $uri $uri/ @production; } location @production { resolver 8.8.8.8; # replace www.livesite.com with the production site URL proxy_pass http://www.livesite.com/$uri; }
What happens if you’re dealing with a multisite VVV setup and maybe the live multisite has mapped domains?
It was suggested to me by Scott Kingsley Clark that this little snippet might work:
try_files $uri $uri/ @production @production2 @production3;
So I made the following changes:
# Directives to send expires headers and turn off 404 error logging. location ~* .(js|css|png|jpg|jpeg|gif|ico|mp3|mov|tif|tiff|swf|txt|html)$ { expires 24h; log_not_found off; try_files $uri $uri/ @production @production1 @production2 @production3 @production4 ; } location @production { resolver 8.8.8.8; # replace www.livesite[d]?.com with the production site URL proxy_pass http://www.livesite.com/$uri; } location @production1 { resolver 8.8.8.8; proxy_pass http://www.livesite1.com/$uri; } location @production2 { resolver 8.8.8.8; proxy_pass http://www.livesite2.com/$uri; } location @production3 { resolver 8.8.8.8; proxy_pass http://www.livesite3.com/$uri; } location @production4 { resolver 8.8.8.8; proxy_pass http://www.livesite4.com/$uri; }
And I’ll be damned if it didn’t work 🙂
You can either make these changes in /etc/nginx/custom-sites/ and restart nginx but I suggest making them in /srv/config/nginx-config/sites/ and re-provision. If you only edit the former, your changes will be overwritten the next time you provision due to the following line in /vagrant/provision/provision.sh
rsync -rvzh --delete /srv/config/nginx-config/sites/ /etc/nginx/custom-sites/
http://youtu.be/eozSLeCBSfY