Last active
August 29, 2015 14:24
-
-
Save gl2748/6e19cfdd277b46b4c4ed to your computer and use it in GitHub Desktop.
docker nginx ghost
This file contains hidden or 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
| docker run -v /data --name ghostdata busybox echo Data-only container for Ghost | |
| from... | |
| docker run -v /data --name ghostdata dockerfile/ubuntu echo Data-only container for Ghost | |
| With that out of the way let's create our Ghost config file, /docker/blog/config.js: | |
| docker run -d --volumes-from ghostdata --name ghostblog -v ~/docker/blog:/ghost-override ghost:latest | |
| docker run -d -p 80:2368 --volumes-from ghostdata --name ghostblog -v ~/docker/blog:/ghost-override ghost:latest | |
| kaching | |
| create your ~/docker/nginx/sites-enabled/ghostblog config file: | |
| Include the proxy_pass variable a la: | |
| server { | |
| listen 80 default; | |
| server_name iainmaitland.com; | |
| location / { | |
| proxy_pass http://ghostblog; | |
| } | |
| } | |
| upstream website { | |
| server website:2368; | |
| } | |
| daemon off; | |
| 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; | |
| # Virtual Host Configs | |
| include /etc/nginx/sites-enabled/*; | |
| } | |
| docker run -d -p 80:80 --name nginx --link ghostblog:ghostblog -v ~/docker/nginx/sites-enabled:/etc/nginx/sites-enabled nginx | |
| what does dockerfile/nginx look like (build this first -pre run...) | |
| FROM ubuntu | |
| RUN apt-get update && apt-get install -y nginx | |
| RUN ln -sf /dev/stdout /var/log/nginx/access.log | |
| RUN ln -sf /dev/stderr /var/log/nginx/error.log | |
| RUN rm -rf /etc/nginx/sites-enabled/default | |
| EXPOSE 80 443 | |
| CMD ["nginx", "-g", "daemon off;"] | |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
server {
listen 80;
server_name ghostblog.iainmaitland.com;
access_log /var/log/nginx/nginx.blog.access.log;
error_log /var/log/nginx/nginx.blog.error.log;
location / {
proxy_pass http://ghostblog:2368;
proxy_set_header X-Forwarded-Host $server_name;
proxy_set_header Host $server_name;
proxy_set_header X-Real-IP $remote_addr;
}
}