Created
May 21, 2016 13:40
-
-
Save amorphobia/27bda1f5199cf0f4729c0c79d0d20347 to your computer and use it in GitHub Desktop.
Ghost + Nginx + Docker
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
// # Ghost Configuration | |
// Setup your Ghost install for various [environments](http://support.ghost.org/config/#about-environments). | |
// Ghost runs in `development` mode by default. Full documentation can be found at http://support.ghost.org/config/ | |
var path = require('path'), | |
config; | |
config = { | |
// ### Production | |
// When running Ghost in the wild, use the production environment. | |
// Configure your URL and mail settings here | |
production: { | |
url: 'http://xuesong.in/blog', | |
mail: {}, | |
database: { | |
client: 'sqlite3', | |
connection: { | |
filename: path.join(process.env.GHOST_CONTENT, '/data/ghost.db') | |
}, | |
debug: false | |
}, | |
server: { | |
host: '0.0.0.0', | |
port: '2368' | |
} | |
}, | |
// ### Development **(default)** | |
development: { | |
// The url to use when providing links to the site, E.g. in RSS and email. | |
// Change this to your Ghost blog's published URL. | |
url: 'http://xuesong.in/blog', | |
// Example mail config | |
// Visit http://support.ghost.org/mail for instructions | |
// ``` | |
// mail: { | |
// transport: 'SMTP', | |
// options: { | |
// service: 'Mailgun', | |
// auth: { | |
// user: '', // mailgun username | |
// pass: '' // mailgun password | |
// } | |
// } | |
// }, | |
// ``` | |
// #### Database | |
// Ghost supports sqlite3 (default), MySQL & PostgreSQL | |
database: { | |
client: 'sqlite3', | |
connection: { | |
filename: path.join(process.env.GHOST_CONTENT, '/data/ghost-dev.db') | |
}, | |
debug: false | |
}, | |
// #### Server | |
// Can be host & port (default), or socket | |
server: { | |
// Host to be passed to node's `net.Server#listen()` | |
host: '0.0.0.0', | |
// Port to be passed to node's `net.Server#listen()`, for iisnode set this to `process.env.PORT` | |
port: '2368' | |
}, | |
// #### Paths | |
// Specify where your content directory lives | |
paths: { | |
contentPath: path.join(process.env.GHOST_CONTENT, '/') | |
} | |
}, | |
// **Developers only need to edit below here** | |
// ### Testing | |
// Used when developing Ghost to run tests and check the health of Ghost | |
// Uses a different port number | |
testing: { | |
url: 'http://0.0.0.0:2369', | |
database: { | |
client: 'sqlite3', | |
connection: { | |
filename: path.join(process.env.GHOST_CONTENT, '/data/ghost-test.db') | |
}, | |
pool: { | |
afterCreate: function (conn, done) { | |
conn.run('PRAGMA synchronous=OFF;' + | |
'PRAGMA journal_mode=MEMORY;' + | |
'PRAGMA locking_mode=EXCLUSIVE;' + | |
'BEGIN EXCLUSIVE; COMMIT;', done); | |
} | |
} | |
}, | |
server: { | |
host: '0.0.0.0', | |
port: '2369' | |
}, | |
logging: false | |
}, | |
// ### Testing MySQL | |
// Used by Travis - Automated testing run through GitHub | |
'testing-mysql': { | |
url: 'http://0.0.0.0:2369', | |
database: { | |
client: 'mysql', | |
connection: { | |
host : '0.0.0.0', | |
user : 'root', | |
password : '', | |
database : 'ghost_testing', | |
charset : 'utf8' | |
} | |
}, | |
server: { | |
host: '0.0.0.0', | |
port: '2369' | |
}, | |
logging: false | |
}, | |
// ### Testing pg | |
// Used by Travis - Automated testing run through GitHub | |
'testing-pg': { | |
url: 'http://0.0.0.0:2369', | |
database: { | |
client: 'pg', | |
connection: { | |
host : '0.0.0.0', | |
user : 'postgres', | |
password : '', | |
database : 'ghost_testing', | |
charset : 'utf8' | |
} | |
}, | |
server: { | |
host: '0.0.0.0', | |
port: '2369' | |
}, | |
logging: false | |
} | |
}; | |
module.exports = config; |
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
nginx: | |
container_name: ghost_blog_nginx | |
image: nginx | |
ports: | |
- "80:80" | |
- "443:443" | |
volumes: | |
- ~/Developer/Docker/ghost_blog/html:/usr/share/nginx/html | |
- ~/Developer/Docker/ghost_blog/nginx:/etc/nginx | |
links: | |
- ghost | |
ghost: | |
container_name: ghost_blog_ghost | |
image: ghost | |
volumes: | |
- ~/Developer/Docker/ghost_blog/ghost:/var/lib/ghost |
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 0.0.0.0:80; | |
server_name xuesong.in; | |
root /usr/share/nginx/html; | |
index index.html index.htm; | |
location /blog { | |
proxy_set_header X-Real-IP $remote_addr; | |
proxy_set_header HOST $http_host; | |
proxy_set_header X-NginX-Proxy true; | |
proxy_pass http://ghost_blog_ghost:2368; | |
proxy_redirect off; | |
} | |
} |
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
types { | |
# Data interchange | |
application/atom+xml atom; | |
application/json json map topojson; | |
application/ld+json jsonld; | |
application/rss+xml rss; | |
application/vnd.geo+json geojson; | |
application/xml rdf xml; | |
# JavaScript | |
# Normalize to standard type. | |
# https://tools.ietf.org/html/rfc4329#section-7.2 | |
application/javascript js; | |
# Manifest files | |
application/manifest+json webmanifest; | |
application/x-web-app-manifest+json webapp; | |
text/cache-manifest appcache; | |
# Media files | |
audio/midi mid midi kar; | |
audio/mp4 aac f4a f4b m4a; | |
audio/mpeg mp3; | |
audio/ogg oga ogg opus; | |
audio/x-realaudio ra; | |
audio/x-wav wav; | |
image/bmp bmp; | |
image/gif gif; | |
image/jpeg jpeg jpg; | |
image/png png; | |
image/svg+xml svg svgz; | |
image/tiff tif tiff; | |
image/vnd.wap.wbmp wbmp; | |
image/webp webp; | |
image/x-jng jng; | |
video/3gpp 3gp 3gpp; | |
video/mp4 f4p f4v m4v mp4; | |
video/mpeg mpeg mpg; | |
video/ogg ogv; | |
video/quicktime mov; | |
video/webm webm; | |
video/x-flv flv; | |
video/x-mng mng; | |
video/x-ms-asf asf asx; | |
video/x-ms-wmv wmv; | |
video/x-msvideo avi; | |
# Serving `.ico` image files with a different media type | |
# prevents Internet Explorer from displaying then as images: | |
# https://github.com/h5bp/html5-boilerplate/commit/37b5fec090d00f38de64b591bcddcb205aadf8ee | |
image/x-icon cur ico; | |
# Microsoft Office | |
application/msword doc; | |
application/vnd.ms-excel xls; | |
application/vnd.ms-powerpoint ppt; | |
application/vnd.openxmlformats-officedocument.wordprocessingml.document docx; | |
application/vnd.openxmlformats-officedocument.spreadsheetml.sheet xlsx; | |
application/vnd.openxmlformats-officedocument.presentationml.presentation pptx; | |
# Web fonts | |
application/font-woff woff; | |
application/font-woff2 woff2; | |
application/vnd.ms-fontobject eot; | |
# Browsers usually ignore the font media types and simply sniff | |
# the bytes to figure out the font type. | |
# https://mimesniff.spec.whatwg.org/#matching-a-font-type-pattern | |
# | |
# However, Blink and WebKit based browsers will show a warning | |
# in the console if the following font types are served with any | |
# other media types. | |
application/x-font-ttf ttc ttf; | |
font/opentype otf; | |
# Other | |
application/java-archive ear jar war; | |
application/mac-binhex40 hqx; | |
application/octet-stream bin deb dll dmg exe img iso msi msm msp safariextz; | |
application/pdf pdf; | |
application/postscript ai eps ps; | |
application/rtf rtf; | |
application/vnd.google-earth.kml+xml kml; | |
application/vnd.google-earth.kmz kmz; | |
application/vnd.wap.wmlc wmlc; | |
application/x-7z-compressed 7z; | |
application/x-bb-appworld bbaw; | |
application/x-bittorrent torrent; | |
application/x-chrome-extension crx; | |
application/x-cocoa cco; | |
application/x-java-archive-diff jardiff; | |
application/x-java-jnlp-file jnlp; | |
application/x-makeself run; | |
application/x-opera-extension oex; | |
application/x-perl pl pm; | |
application/x-pilot pdb prc; | |
application/x-rar-compressed rar; | |
application/x-redhat-package-manager rpm; | |
application/x-sea sea; | |
application/x-shockwave-flash swf; | |
application/x-stuffit sit; | |
application/x-tcl tcl tk; | |
application/x-x509-ca-cert crt der pem; | |
application/x-xpinstall xpi; | |
application/xhtml+xml xhtml; | |
application/xslt+xml xsl; | |
application/zip zip; | |
text/css css; | |
text/html htm html shtml; | |
text/mathml mml; | |
text/plain txt; | |
text/vcard vcard vcf; | |
text/vnd.rim.location.xloc xloc; | |
text/vnd.sun.j2me.app-descriptor jad; | |
text/vnd.wap.wml wml; | |
text/vtt vtt; | |
text/x-component htc; | |
} |
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
user nginx; | |
worker_processes 1; | |
error_log /var/log/nginx/error.log warn; | |
pid /var/run/nginx.pid; | |
events { | |
worker_connections 1024; | |
} | |
http { | |
include /etc/nginx/mime.types; | |
default_type application/octet-stream; | |
log_format main '$remote_addr - $remote_user [$time_local] "$request" ' | |
'$status $body_bytes_sent "$http_referer" ' | |
'"$http_user_agent" "$http_x_forwarded_for"'; | |
access_log /var/log/nginx/access.log main; | |
sendfile on; | |
#tcp_nopush on; | |
keepalive_timeout 65; | |
#gzip on; | |
include /etc/nginx/conf.d/*.conf; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment