[TIL] Concert, Let’s Encrypt 证书生成工具

Wednesday, September 7, 2016

setup go enviroment

[email protected]:~# aria2c https://storage.googleapis.com/golang/go1.7.linux-amd64.tar.gz
[email protected]:~# tar zxvf go1.7.linux-amd64.tar.gz
[email protected]:~# mv go /usr/local

[email protected]:~# vim .bashrc

    export GOPATH=~/gocode
    export PATH=$GOPTH/bin:/usr/local/go/bin:$PATH

[email protected]:~# source .bashrc

# test env
[email protected]:~# mkdir -p gocode/src/hello
[email protected]:~# vi gocode/src/hello/hello.go

    package main

    import "fmt"

    func main() {
        fmt.Printf("hello, world\n")
    }

[email protected]:~# go install hello
[email protected]:~# $GOPATH/bin/hello
hello, world

install concert

[email protected]:~# go get -u github.com/minio/concert

concert usage

generate

[email protected]:~# sudo $GOPATH/bin/concert gen [email protected] lxneng.com
2016/09/07 11:14:51 Generated certificates for lxneng.com under certs will expire in 89 days.

renew

[email protected]:~# sudo $GOPATH/bin/concert renew [email protected]
2016/09/07 11:16:52 Keys have not expired yet, please renew in 89 days.

auto renew once in every 45 days.

[email protected]:~# sudo $GOPATH/bin/concert server [email protected] lxneng.com
2016/09/07 11:18:06 Starting timer thread waiting for 45

config nginx

upstream lxneng {
    server 127.0.0.1:1986;
}
server{
    listen 443 ssl;
    ssl_certificate /root/certs/public.crt;
    ssl_certificate_key /root/certs/private.key;

    server_name lxneng.com;
    location / {
        root /var/www/lxneng.com/src/lxneng/static;
        try_files $uri $uri @wsgiapp;
    }

    location @wsgiapp {
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header Host $http_host;
        proxy_redirect off;
        proxy_pass   http://lxneng;
    }
}
server {
    listen       80;
    server_name  www.lxneng.com lxneng.com;
    rewrite ^ https://lxneng.com$request_uri? permanent;
}

reference

This entry was tagged SSL and Devlog

comments powered by Disqus

© 2009-2013 lxneng.com. All rights reserved. Powered by Pyramid

go to Top