设置Leanote走SSL(https)--非docker安装方式下

自建的Leanote 默认是走http,确实不太安全,网上百度下会发现安装(设置)nginx配置,不知道他们是怎么成功的,Leanote都不依赖nginx的。
实际是配置 Leanote 的app.conf
修改如下
http.ssl = false 改为true
下面的添加进去
http.sslcert=/XXX/XXXX.crt
http.sslkey=/XXX/XXXXXX.key 改成自己的路径名称

 再重启Leanote 

------------------如果上面这样设置还不行,那就再添加下面-----------------------------------------------

Try putting this in your app/init.go file: (Leanote文件夹下面的app文件夹下面,注意有2个 都试下)

httpRedirectServer := &http.Server{Addr: ":8899", Handler: http.HandlerFunc(
func(w http.ResponseWriter, r *http.Request) {
http.Redirect(w, r, fmt.Sprintf("https://%s%s", r.Host, r.RequestURI),
http.StatusMovedPermanently)
})}
go httpRedirectServer.ListenAndServe()

8899可以改成跟app.conf里面端口一样的。然后重启.

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容