Skip to content

Instantly share code, notes, and snippets.

@plcosta
Last active July 11, 2017 14:24
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 plcosta/7f22f97672fe00ba2a7ec699fba461c5 to your computer and use it in GitHub Desktop.
Save plcosta/7f22f97672fe00ba2a7ec699fba461c5 to your computer and use it in GitHub Desktop.
nginx conf for uploads directory - development/staging environment - get uploads from production
server {
listen 443 ssl http2;
listen [::]:443 ssl http2;
...
...
...
# Matches any URL containing /wp-content/uploads/ or /app/uploads/ (using bedrock)
location ~ "^(.*)/app/uploads/(.*)$" {
try_files $uri @prod_serv;
}
# Will redirect requests to your production server
location @prod_serv {
rewrite "^(.*)/app/uploads/(.*)$" "https://example.com/app/uploads/$2" redirect;
}
location / {
try_files $uri $uri/ /index.php?$query_string;
}
...
...
...
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment