Menu

  • Home
  • Archives
  • Tags
  • RSS
June 1, 2018

Setting up the static site

(Some notes on setting up docker/nginx to serve what Cryogen generated)

Pull in the repo, install required components

$ git clone https://github.com/agam/personal-site.git

$ sudo aptitude install docker

$ docker pull nginx

Ensure output generated by cryogen is satisfactory

$ lein ring server-headless

Basic test

$ docker run --name docker-nginx-myweb -p 80:80 -d  -v ~/Github/personal-site/resources/public:/usr/share/nginx/html nginx

Sanity checks

  • Check http://104.225.223.24/
  • Go to namecheap, set up A record
  • Verify that http://agambrahma.com/blog works

Set up redirect to /blog

$ mkdir docker-nginx; cd docker-nginx
$ docker cp docker-nginx-myweb:/etc/nginx/conf.d/default.conf default.conf

Get '/' to serve '/blog'

Make the following change/replacement:

    location = / {
        root /usr/share/nginx/html;
        rewrite "^.$" /blog break;
    }

    location /blog {
        root /usr/share/nginx/html;
        index index.html index.htm;
    }

Use both a custom serving path and a custom config for the nginx container

(stop and remove the old container first)

docker run --name docker-nginx-myweb -p 80:80 -d  -v ~/Github/personal-site/resources/public:/usr/share/nginx/html -v ~/docker-nginx/default.conf:/etc/nginx/conf.d/default.conf  nginx

Note: for all tweaks to the config, since nginx doesn't "hot-load" it, the container has to be restarted:

$ docker restart docker-nginx-myweb

Tags: setup

« On the wisdom in old papers First Post »

Copyright © 2020 Agam Brahma

Powered by Cryogen