Skip to content

Instantly share code, notes, and snippets.

@mheland
Last active May 25, 2023 20:35
Show Gist options
  • Save mheland/29f690e4bbab8bdade562ee8fe9b9125 to your computer and use it in GitHub Desktop.
Save mheland/29f690e4bbab8bdade562ee8fe9b9125 to your computer and use it in GitHub Desktop.
location / {
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header Host $http_host;
# Ghost on port 2368
proxy_pass http://127.0.0.1:2368;
# Multiple replacements
sub_filter_once off;
# Disable gzip for sub_filter
proxy_set_header Accept-Encoding "";
# images, including srcset
sub_filter 'https://www.mysite.com/content/images/' 'https://cdn.mysite.com/content/images/';
# poster images are linked as background....
sub_filter 'background-image:url(/content' 'background-image:url(https://cdn.mysite.com/content';
# javascript files
sub_filter '/assets/js/' 'https://cdn.mysite.com/assets/js/';
# stylesheets
sub_filter '/assets/css/' 'https://cdn.mysite.com/assets/css/';
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment