Skip to content

Instantly share code, notes, and snippets.

@aiiddqd
Forked from gregrickaby/example-nginx.conf
Last active August 8, 2018 16:45
Show Gist options
  • Save aiiddqd/55419e049588be38eeac50e298fb7a36 to your computer and use it in GitHub Desktop.
Save aiiddqd/55419e049588be38eeac50e298fb7a36 to your computer and use it in GitHub Desktop.
Defer the loading of images to the production/live server if file not exist - NGINX
server {
# base nginx conf
location ~ ^/wp-content/uploads/(.*) {
try_files $uri @live_uploads;
}
location @live_uploads {
rewrite ^/wp-content/uploads/(.*)$ https://livewebsite.com/wp-content/uploads/$1 permanent;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment