Fix service file slightly, use let's encrypt to get a certificate
This commit is contained in:
parent
9b8ad465d7
commit
467006aabc
|
@ -1 +1,2 @@
|
||||||
kelvinly-server
|
kelvinly-server
|
||||||
|
*.pem
|
||||||
|
|
|
@ -17,3 +17,6 @@ source ~/.bashrc
|
||||||
go get -u gopkg.in/russross/blackfriday.v2
|
go get -u gopkg.in/russross/blackfriday.v2
|
||||||
go get -u github.com/shurcooL/github_flavored_markdown
|
go get -u github.com/shurcooL/github_flavored_markdown
|
||||||
go get -u github.com/sevlyar/go-daemon
|
go get -u github.com/sevlyar/go-daemon
|
||||||
|
|
||||||
|
sudo apt-get install certbot -t stretch-backports
|
||||||
|
mkdir -p certbot-tmp
|
||||||
|
|
|
@ -3,6 +3,7 @@ Description=My main HTTP server
|
||||||
After=network.target syslog.target
|
After=network.target syslog.target
|
||||||
|
|
||||||
[Service]
|
[Service]
|
||||||
|
User=kelvin
|
||||||
Type=forking
|
Type=forking
|
||||||
PIDFile=/tmp/kelvinly-server-pid
|
PIDFile=/tmp/kelvinly-server-pid
|
||||||
ExecStart=/home/kelvin/kelvinly-server/kelvinly-server
|
ExecStart=/home/kelvin/kelvinly-server/kelvinly-server
|
||||||
|
|
4
main.go
4
main.go
|
@ -38,6 +38,9 @@ const HTML_HEADER = `<!doctype html5>
|
||||||
`
|
`
|
||||||
|
|
||||||
const HTML_FOOTER = ` </article>
|
const HTML_FOOTER = ` </article>
|
||||||
|
<footer>
|
||||||
|
by Kelvin Ly, source available <a href="https://github.com/cactorium/kelvinly-server">here</a>
|
||||||
|
</footer>
|
||||||
</body>
|
</body>
|
||||||
</html>`
|
</html>`
|
||||||
|
|
||||||
|
@ -157,6 +160,7 @@ func startServer(srv *http.Server) {
|
||||||
log.Print("installing handlers")
|
log.Print("installing handlers")
|
||||||
serveMux := http.NewServeMux()
|
serveMux := http.NewServeMux()
|
||||||
serveMux.HandleFunc("/", rootHandler)
|
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.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") })
|
serveMux.HandleFunc("/main.css", func(w http.ResponseWriter, r *http.Request) { http.ServeFile(w, r, "main.css") })
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue