Skip to content

Instantly share code, notes, and snippets.

@jeffgca
Created October 22, 2013 03:06
Show Gist options
  • Save jeffgca/7094595 to your computer and use it in GitHub Desktop.
Save jeffgca/7094595 to your computer and use it in GitHub Desktop.
working nginx config for ghost NOTE YOU WILL NEED TO EDIT SOME VALUES HERE FOR IT TO WORK
upstream ghost_upstream {
server 127.0.0.1:2368;
keepalive 64;
}
# drop www
server {
listen 80;
server_name www.somedomain.org;
rewrite ^/(.*) $scheme://somedomain.org/$1 permanent;
}
# redirect all other unmapped domains here.
server {
listen 80 default;
server_name _;
rewrite ^ $scheme://somedomain.org permanent;
}
server {
listen 80;
server_name somedomain.org;
location = /favicon.ico {
log_not_found off;
access_log off;
}
# re-write the old RSS url to the new one
location = /atom.xml {
rewrite ^ $scheme://somedomain.org/rss/ permanent;
}
location ~ ^/(img/|css/|lib/|vendor/|fonts/|robots.txt|humans.txt) {
root /path/to/ghost/core/client/assets;
access_log off;
expires max;
}
location ~ ^/(shared/|built/) {
root /path/to/ghost/core;
access_log off;
expires max;
}
location ~ ^/(content/images/) {
root /path/to/ghost/;
access_log off;
expires max;
}
location / {
proxy_redirect off;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header Host $http_host;
proxy_set_header X-NginX-Proxy true;
proxy_set_header Connection "";
proxy_http_version 1.1;
proxy_pass http://ghost_upstream;
proxy_max_temp_file_size 0;
client_max_body_size 10m;
client_body_buffer_size 128k;
proxy_connect_timeout 90;
proxy_send_timeout 90;
proxy_read_timeout 90;
proxy_buffer_size 4k;
proxy_buffers 4 32k;
proxy_busy_buffers_size 64k;
proxy_temp_file_write_size 64k;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment