从零开始部署Excalidraw

docker-compose配置文件

services:
  frontend:
    image: yinhuihe/excalidraw
    environment:
      - VITE_APP_BACKEND_V2_GET_URL=https://draw.gcboy.com.cn/api/v2/scenes/
      - VITE_APP_BACKEND_V2_POST_URL=https://draw.gcboy.com.cn/api/v2/scenes/
      - VITE_APP_WS_SERVER_URL=https://draw.gcboy.com.cn
      - VITE_APP_FIREBASE_CONFIG={}
      - VITE_APP_HTTP_STORAGE_BACKEND_URL=https://draw.gcboy.com.cn/api/v2
      - VITE_APP_STORAGE_BACKEND=http
    ports:
      - 8080:80
  storage:
    image: yinhuihe/excalidraw-storage-backend:latest
    restart: always
    environment:
      STORAGE_URI: redis://redis:6379
    ports:
      - 8081:8080
  room:
    image: yinhuihe/excalidraw-room:latest
    ports:
      - 8082:80
  redis:
    image: redis
    ports: 
      - 6379:6379

nginx反向代理配置

server {
  server_name draw.gcboy.com.cn;
  listen 443 ssl http2;
  ssl_certificate /etc/ssl/certs/draw.gcboy.com.cn_bundle.crt;
  ssl_certificate_key /etc/ssl/certs/draw.gcboy.com.cn.key;
  ssl_protocols TLSv1 TLSv1.1 TLSv1.2 TLSv1.3;
  listen 80;
  if ($scheme = http) {
    return 301 https://$host:443$request_uri;
  }
  location / {
    proxy_pass http://127.0.0.1:8080;
    proxy_set_header Host $host;
    proxy_set_header X-Real-IP $remote_addr;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_set_header X-Forwarded-Host $http_host;
    proxy_set_header X-Forwarded-Port $server_port;
    proxy_set_header X-Forwarded-Proto $scheme;
    proxy_http_version 1.1;
    proxy_set_header Upgrade $http_upgrade;
    proxy_set_header Connection "upgrade";
    add_header Access-Control-Allow-Origin *;
    add_header Access-Control-Allow-Methods *;
    add_header Access-Control-Allow-Headers *;
    add_header Access-Control-Allow-Credentials true;
    if ($request_method = 'OPTIONS') {
      return 204;
    }
    proxy_redirect http:// https://;
  }
  location /api/v2 {
    proxy_pass http://127.0.0.1:8081;
    proxy_set_header Host $host;
    proxy_set_header X-Real-IP $remote_addr;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_set_header X-Forwarded-Host $http_host;
    proxy_set_header X-Forwarded-Port $server_port;
    proxy_set_header X-Forwarded-Proto $scheme;
    proxy_http_version 1.1;
    proxy_set_header Upgrade $http_upgrade;
    proxy_set_header Connection "upgrade";
    add_header Access-Control-Allow-Origin *;
    add_header Access-Control-Allow-Methods *;
    add_header Access-Control-Allow-Headers *;
    add_header Access-Control-Allow-Credentials true;
    if ($request_method = 'OPTIONS') {
      return 204;
    }
    proxy_redirect http:// https://;
  }
  location /socket.io/ {
    proxy_pass http://127.0.0.1:8082;
    proxy_set_header Host $host;
    proxy_set_header X-Real-IP $remote_addr;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_set_header X-Forwarded-Host $http_host;
    proxy_set_header X-Forwarded-Port $server_port;
    proxy_set_header X-Forwarded-Proto $scheme;
    proxy_http_version 1.1;
    proxy_set_header Upgrade $http_upgrade;
    proxy_set_header Connection "upgrade";
    add_header Access-Control-Allow-Origin *;
    add_header Access-Control-Allow-Methods *;
    add_header Access-Control-Allow-Headers *;
    add_header Access-Control-Allow-Credentials true;
    if ($request_method = 'OPTIONS') {
      return 204;
    }
    proxy_redirect http:// https://;
  }
}
© 版权声明
THE END
喜欢就支持一下吧
点赞12 分享
评论 抢沙发
头像
欢迎您留下宝贵的见解!
提交
头像

昵称

取消
昵称表情代码图片

    暂无评论内容