Skip to content

Instantly share code, notes, and snippets.

@ihgrant
Last active May 18, 2017 02:00
Show Gist options
  • Save ihgrant/9e63582c4d3490d4f5dbcc6b631a40b5 to your computer and use it in GitHub Desktop.
Save ihgrant/9e63582c4d3490d4f5dbcc6b631a40b5 to your computer and use it in GitHub Desktop.
nginx ghost config
upstream ghost_upstream {
server 127.0.0.1:2368;
keepalive 64;
}
server {
server_name blog.chenghiz.net;
add_header X-Cache $upstream_cache_status;
location / {
proxy_cache STATIC;
proxy_cache_valid 200 30m;
proxy_cache_valid 404 1m;
proxy_pass http://ghost_upstream;
proxy_ignore_headers X-Accel-Expires Expires Cache-Control;
proxy_ignore_headers Set-Cookie;
proxy_hide_header Set-Cookie;
proxy_hide_header X-powered-by;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
expires 10m;
}
location /content/images {
alias /path/to/ghost/content/images;
access_log off;
expires max;
}
location /assets {
alias /path/to/ghost/content/themes/uno-master/assets;
access_log off;
expires max;
}
location /public {
alias /path/to/ghost/core/built/public;
access_log off;
expires max;
}
location /ghost/scripts {
alias /path/to/ghost/core/built/scripts;
access_log off;
expires max;
}
location ~ ^/(?:ghost|signout) {
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header Host $http_host;
proxy_pass http://ghost_upstream;
add_header Cache-Control "no-cache, private, no-store,
must-revalidate, max-stale=0, post-check=0, pre-check=0";
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment