Fix service file slightly, use let's encrypt to get a certificate

This commit is contained in:
Kelvin Ly (on the cloud) 2018-09-28 22:41:31 +00:00
parent 9b8ad465d7
commit 467006aabc
4 changed files with 9 additions and 0 deletions

1
.gitignore vendored
View File

@ -1 +1,2 @@
kelvinly-server
*.pem

View File

@ -17,3 +17,6 @@ source ~/.bashrc
go get -u gopkg.in/russross/blackfriday.v2
go get -u github.com/shurcooL/github_flavored_markdown
go get -u github.com/sevlyar/go-daemon
sudo apt-get install certbot -t stretch-backports
mkdir -p certbot-tmp

View File

@ -3,6 +3,7 @@ Description=My main HTTP server
After=network.target syslog.target
[Service]
User=kelvin
Type=forking
PIDFile=/tmp/kelvinly-server-pid
ExecStart=/home/kelvin/kelvinly-server/kelvinly-server

View File

@ -38,6 +38,9 @@ const HTML_HEADER = `<!doctype html5>
`
const HTML_FOOTER = ` </article>
<footer>
by Kelvin Ly, source available <a href="https://github.com/cactorium/kelvinly-server">here</a>
</footer>
</body>
</html>`
@ -157,6 +160,7 @@ func startServer(srv *http.Server) {
log.Print("installing handlers")
serveMux := http.NewServeMux()
serveMux.HandleFunc("/", rootHandler)
//serveMux.Handle("/certbot/", http.StripPrefix("/certbot/", http.FileServer(http.Dir("./certbot-tmp"))))
serveMux.Handle("/gfm/", http.StripPrefix("/gfm", http.FileServer(gfmstyle.Assets)))
serveMux.HandleFunc("/main.css", func(w http.ResponseWriter, r *http.Request) { http.ServeFile(w, r, "main.css") })