常规编译
# 克隆源码
git clone https://github.com/lzqqdy/mindoc.git
# go包安装
go mod tidy -v
# 编译(sqlite需要CGO支持)
go build -ldflags "-w" -o mindoc main.go
# 数据库初始化(此步骤执行之前,需配置`conf/app.conf`)
./mindoc install
# 执行
./mindoc
Ngnix反向代理+SSL
server {
listen 80;
listen 443 ssl http2;
#此处应该配置你的域名:
server_name iwiki.lzqqdy.cn;
charset utf-8;
#SSL-START SSL相关配置,请勿删除或修改下一行带注释的404规则
#error_page 404/404.html;
#HTTP_TO_HTTPS_START
if ($server_port !~ 443){
rewrite ^(/.*)$ https://$host$1 permanent;
}
#HTTP_TO_HTTPS_END
ssl_certificate /www/server/panel/vhost/cert/iwiki.lzqqdy.cn/iwiki.lzqqdy.cn_bundle.pem;
ssl_certificate_key /www/server/panel/vhost/cert/iwiki.lzqqdy.cn/iwiki.lzqqdy.cn.key;
ssl_prefer_server_ciphers on;
ssl_session_cache shared:SSL:10m;
ssl_session_timeout 10m;
add_header Strict-Transport-Security "max-age=31536000";
error_page 497 https://$host$request_uri;
client_max_body_size 100m;
#此处配置你的访问日志,请手动创建该目录:
access_log /www/wwwlogs/iwiki.lzqqdy.cn.log;
location / {
try_files /_not_exists_ @backend;
}
#一键申请SSL证书验证目录相关设置
location ~ \.well-known{
allow all;
}
# 这里为具体的服务代理配置
location @backend {
proxy_set_header X-Forwarded-For $remote_addr;
proxy_set_header Host $http_host;
proxy_set_header X-Forwarded-Proto $scheme;
#此处配置 MinDoc 程序的地址和端口号
proxy_pass http://127.0.0.1:8181;
}
}
作者:lzqqdy 创建时间:2022-08-16 10:14
最后编辑:lzqqdy 更新时间:2023-04-11 23:11
最后编辑:lzqqdy 更新时间:2023-04-11 23:11