同步笔记

date
Apr 28, 2022
slug
newservice-note-synchronized
status
Published
summary
新服务
tags
service
type
Post
URL
notion image

Summary

步骤

宝塔先建立 note.xxx.xxx

下载代码

SERVICE_DOMAIN=‘note.xxx.xxx’

cd /www/wwwroot
mv $SERVICE_DOMAIN $SERVICE_DOMAIN.backup

git clone https://github.com/pereorga/minimalist-web-notepad $SERVICE_DOMAIN

# 若要保留 .user.ini 和 .htaccess 就cp 过来
chown -R www:www $SERVICE_DOMAIN && chmod 766 $SERVICE_DOMAIN

修改

  • base_url
notion image
notion image
  • nginx
location / {
    rewrite ^/([a-zA-Z0-9_-]+)$ /index.php?note=$1;
}
notion image
notion image
  • 开启SSL

验证

notion image
 
 

docker (nginx rewrite配置不能少)

DOCKER_PORT=18390
DOCKER_PROJ='minimalist-web-notepad'

cd /data
# 📢: 是encryption branch
git clone -b encryption https://github.com/pereorga/minimalist-web-notepad $DOCKER_PROJ

# 若要保留 .user.ini 和 .htaccess 就cp 过来
# chown -R www:www $SERVICE_DOMAIN && chmod 766 $SERVICE_DOMAIN

git clone https://github.com/pereorga/minimalist-web-notepad/tree/docker $DOCKER_PROJ
cd $DOCKER_PROJ
# 把index.php当中的 $base_url = getenv('MWN_BASE_URL') ?: '';
docker build -t $DOCKER_PROJ .
chown -R www-data:www-data ./_tmp && chmod 755 ./_tmp
docker run -d --name minimalist-web-notepad -p $DOCKER_PORT:80 $DOCKER_PROJ
docker logs -f $DOCKER_PROJ

docker-compose up -d
notion image
notion image
notion image
notion image
version: "2.4"
services:
  minimalist-web-notepad:
    build: .
    container_name: minimalist-web-notepad
    restart: always
    #ports:
    # - "18390:80"
    volumes:
     - ./_tmp:/var/www/minimalist-web-notepad/_tmp
    #environment:
     # if using encryption, then sharing url will look like 
     # https://note.xxx.xxx/kejkj#p7w3jecf7w9bgaxy
     #- MWN_ENCRYPTION=true
     #- MWN_CRYPTO_SALT=8f5L655xxx
     #- MWN_BASE_URL=https://note.xxx.xxx

volumes:
  minimalist-web-notepad:
networks:
  default:
    name: npm_nginx_proxy_manager-network
    external: true


chown -R www-data:www-data ./_tmp && chmod 755 ./_tmp
docer-compose.yml
notion image
notion image

© Ying Bun 2021 - 2024