用 docker-compose 部署 memos
memos
A lightweight, self-hosted memo hub. Open Source and Free forever.
Installing
需要安装的依赖
- git
- docker 及 docker-compose
用 docker-compose 部署
- 克隆仓库到本机
- 打开
memos
文件夹 - 启动 memos
1git clone -b main https://github.com/usememos/memos.git
2cd memos
3docker-compose up -d
用 nginx 反代
- 创建配置文件
memos.conf
- 编辑配置文件
- 测试配置文件
- 重启 nginx
1nano /etc/nginx/conf.d/memos.conf
2# 编辑内容并保存
3nginx -t
4nginx -s restart
[!tips] 用 DigitalOcean NGINXConfig Tool 生成 nginx 配置文件
1# memos.conf 文件内容
2server {
3 listen 443 ssl http2;
4 listen [::]:443 ssl http2;
5 server_name example.com;
6
7 # SSL
8 ssl_certificate /etc/ssl/example.pem; # 证书存放路径
9 ssl_certificate_key /etc/ssl/example.key; # 私钥存放路径
10 ssl_session_timeout 5s;
11 ssl_protocols TLSv1.1 TLSv1.2 TLSv1.3;
12 ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:HIGH:!aNULL:!MD5:!RC4:!DHE;
13 ssl_prefer_server_ciphers on;
14
15 # security
16 add_header Referrer-Policy "no-referrer" always;
17
18 # reverse proxy
19 location / {
20 proxy_pass http://127.0.0.1:5230;
21 proxy_set_header Host $host;
22 proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
23 proxy_set_header X-Scheme $scheme;
24 }
25
26 # gzip
27 gzip on;
28 gzip_vary on;
29 gzip_proxied any;
30 gzip_comp_level 6;
31 gzip_types text/plain text/css text/xml application/json application/javascript application/rss+xml application/atom+xml image/svg+xml;
32}
33
34# HTTP redirect
35server {
36 listen 80;
37 listen [::]:80;
38 server_name memos.notomorrow.club;
39 return 301 https://example.com$request_uri;
40}