一个可分享的快速粘贴文本的容器Hasty Paste,如果写一些脚本的话会很方便。
docker-compose.yaml
1 2 3 4 5 6 7 8 9 10 11 12 13 14
| version: "3" services: paste-bin: image: ghcr.io/enchant97/hasty-paste:latest container_name: hasty-paste restart: unless-stopped user: root ports: - 127.0.0.1:4579:8000 volumes: - /home/<username>/hasty-paste/data:/app/data environment: - "TIME_ZONE=Asia/Shanghai"
|
一般为了安全,我们会将user设置为1000:1000,但是我们还需要对本地映射文件夹改变归属者,要不然访问会出错。
chown -R 1000:1000 /home/<username>/hasty-paste
反向代理
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48
| server { listen 80; listen 443 ssl; server_name xxxx; ssl_certificate crt/pem; ssl_certificate_key key; location /new { auth_basic "Please input password"; auth_basic_user_file /home/<username>/ssl/password; proxy_pass http://127.0.0.1:4579; proxy_set_header Host $host; proxy_set_header X-Forwarded-For $real; add_header X-Cache $upstream_cache_status; add_header Cache-Control no-cache; } location /api/ { auth_basic "Please input password"; auth_basic_user_file /home/<username>/ssl/password; proxy_pass http://127.0.0.1:4579; proxy_set_header Host $host; proxy_set_header X-Forwarded-For $real; add_header X-Cache $upstream_cache_status; add_header Cache-Control no-cache; } location / { proxy_pass http://127.0.0.1:4579; proxy_set_header Host $host; proxy_set_header X-Forwarded-For $real; add_header X-Cache $upstream_cache_status; add_header Cache-Control no-cache;
} access_log /www/wwwlogs/paste-bin.log main; }
|
密码设置参考:跳转
参考:
https://enchantedcode.co.uk/hasty-paste/index.html
https://blog.laoda.de/archives/docker-compose-install-hasty-paste/