microbin支持的功能非常丰富,除了能粘贴代码块,还能上传文件,如果直接粘贴一个url还能作为网址缩短来使用。
项目地址:https://github.com/szabodanika/microbin
安装这里我使用docker,先安装需要用到的包:
apt -y update apt -y install docker.io docker-compose nginx python3-certbot-nginx
新建docker-compose.yml:
mkdir /opt/microbin-docker && cd /opt/microbin-docker && nano docker-compose.yml
写入如下配置:
version: '3.5' services: microbin: image: danielszabo99/microbin:latest container_name: microbin restart: unless-stopped environment: - TZ=Asia/Shanghai - MICROBIN_HIGHLIGHTSYNTAX=true - MICROBIN_EDITABLE=true - MICROBIN_PRIVATE=true - MICROBIN_HIDE_FOOTER=true - MICROBIN_HIDE_HEADER=false - MICROBIN_HIDE_LOGO=false - MICROBIN_NO_ETERNAL_PASTA=false - MICROBIN_NO_FILE_UPLOAD=false - MICROBIN_NO_LISTING=false - MICROBIN_THREADS=2 - MICROBIN_TITLE=imlalabin - MICROBIN_PUBLIC_PATH=https://microbin.example.com // 修改为你的域名 - MICROBIN_QR=true ports: - 31000:8080 volumes: - ./microbin-data:/app/pasta_data
所有可用的环境变量可看这里:https://microbin.eu/documentation/
启动:
docker-compose up -d
配置nginx反代:
nano /etc/nginx/conf.d/microbin.conf
写入如下配置:
server { listen 80; server_name microbin.example.com; client_max_body_size 1024M; location / { proxy_pass http://127.0.0.1:31000$request_uri; 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; } }
签发ssl证书:
certbot --nginx
预览图: