Created
July 6, 2015 06:18
-
-
Save khoa-le/c7b8f2a85bcc5929c965 to your computer and use it in GitHub Desktop.
Installing ghost with nginx proxy-cache
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
upstream ghost_upstream { | |
server 127.0.0.1:2368; | |
keepalive 64; | |
} | |
proxy_cache_path /var/run/cache levels=1:2 keys_zone=STATIC:75m inactive=24h max_size=512m; | |
server { | |
server_name domain.com; | |
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