本机环境Debian10,已安装nginx,mysql,docker
halo支持mysql及H2
本文以H2为例安装
server:
port: 8090
spring:
datasource:
driver-class-name: org.h2.Driver
url: jdbc:h2:file:~/.halo/db/halo
username: 数据库名
password: 数据库密码
h2:
console:
settings:
web-allow-others: false
path: /h2-console
enabled: false
{/tabs-pane}
{tabs-pane label="mysql配置"}
server:
port: 8090
spring:
datasource:
driver-class-name: com.mysql.cj.jdbc.Driver
url: jdbc:mysql://127.0.0.1:3306/halodb?characterEncoding=utf8&useSSL=false&serverTimezone=Asia/Shanghai&allowPublicKeyRetrieval=true
username: mysql用户名
password: mysql密码
{/tabs-pane}
创建docker容器
docker run -it -d --name halo -p 8090:8090 -v ~/.halo:/root/.halo --restart=unless-stopped halohub/halo:1.5.3
将需要的配置复制下来命名为application.yaml放在.halo目录下
-p设置对外端口,-v设置在本地映射的目录,前者是本地系统的,后者在docker容器中
放行8090端口即可访问
nginx反向代理配置
upstream halo {
server 127.0.0.1:8090;
}
server {
listen 80;
listen [::]:80;
server_name www.yourdomain.com;
client_max_body_size 1024m;
location / {
proxy_pass http://halo;
proxy_set_header HOST $host;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
}
安装有宝塔面板的可以新建站点在反向代理中设置代理,名称随意,目标urlhttp://127.0.0.1:8090 发送域名$host
详细配置在官网文档https://docs.halo.run/
评论 (0)