Skip to content

Instantly share code, notes, and snippets.

@RiFi2k
Created May 11, 2019 06:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save RiFi2k/5c41dfba2e4ea7b57d2daa82b47a7ca7 to your computer and use it in GitHub Desktop.
Save RiFi2k/5c41dfba2e4ea7b57d2daa82b47a7ca7 to your computer and use it in GitHub Desktop.
location ~* ^.+\.(svg|svgz|jpg|jpeg|gif|png|ico|bmp)$ {
try_files $uri $uri/ @stage;
}
location @stage {
resolver 8.8.8.8;
rewrite ^/wp-content/(.*) /$1; # In S3, the path starts with /uploads
proxy_pass http://stagebucket.s3-website-us-east-1.amazonaws.com$uri;
proxy_intercept_errors on;
error_page 404 = @production;
}
location @production {
resolver 8.8.8.8;
rewrite ^/wp-content/(.*) /$1; # In S3, the path starts with /uploads
proxy_pass http://prodbucket.s3-website-us-east-1.amazonaws.com$uri;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment