Last active
July 11, 2017 14:24
-
-
Save plcosta/7f22f97672fe00ba2a7ec699fba461c5 to your computer and use it in GitHub Desktop.
nginx conf for uploads directory - development/staging environment - get uploads from production
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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