hantu 发布的文章

创建 rc.local 文件

cat <<EOF >/etc/rc.local
#!/bin/sh -e
#
# rc.local
#
# This script is executed at the end of each multiuser runlevel.
# Make sure that the script will "exit 0" on success or any other
# value on error.
#
# In order to enable or disable this script just change the execution
# bits.
#
# By default this script does nothing.

exit 0
EOF

赋权

chmod +x /etc/rc.local

Debian 9 没有 rc.local 文件,但有 rc.local 服务。
启动 rc-local 服务

systemctl start rc-local

把需要开机启动的命令添加到 /etc/rc.local 文件,写在 exit 0 前面,重启以后看效果。

安装 Dockers 和 Dockers-Compose

apt install curl python-pip -y
curl -fsSL get.docker.com -o get-docker.sh && sh get-docker.sh
pip install docker-compose

编辑 docker-compose.yml

version: '3'

services:
  db:
    image: mysql:5.7
    container_name: chevereto_db
    volumes:
      - ./db_data:/var/lib/mysql
    restart: always
    environment:
      MYSQL_ROOT_PASSWORD: chevereto_root
      MYSQL_DATABASE: chevereto
      MYSQL_USER: chevereto
      MYSQL_PASSWORD: chevereto

  chevereto:
    depends_on:
      - db
    image: einverne/chevereto:latest
    # build: ./
    container_name: chevereto
    restart: always
    environment:
      CHEVERETO_DB_HOST: db:3306
      CHEVERETO_DB_USERNAME: chevereto
      CHEVERETO_DB_PASSWORD: chevereto
      CHEVERETO_DB_NAME: chevereto
      CHEVERETO_DB_PREFIX: chv_
    volumes:
      - ./chevereto:/var/www/html/images
      - ./chevereto_content:/var/www/html/content
      - ./conf/php.ini:/usr/local/etc/php/conf.d/php.ini
    ports:
      - 80:80

创建外部目录

mkdir chevereto chevereto_content conf

编辑 conf/php.ini 取消 2M 上传限制

PHP:
max_execution_time = 60;
memory_limit = 256M;
upload_max_filesize = 256M;
post_max_size =  256M;

调整权限

chown -R www-data:www-data chevereto chevereto_content conf

启动

docker-compose up -d

echo -e "net.core.default_qdisc=fq\nnet.ipv4.tcp_congestion_control=bbr" >> /etc/sysctl.conf
sysctl -p

执行 lsmod | grep bbr, 看到有 tcp_bbr 模块即说明 bbr 已启动

docker run -it --rm -v /home/go:/go --name gost golang
go get -d github.com/ginuerzh/gost/cmd/gost
#如需切换到2.6版本可进 src/github.com/ginuerzh/gost/
git checkout 2.6
CGO_ENABLED=0 GOOS=linux GOARCH=mips GOMIPS=softfloat go build -o gost_mips github.com/ginuerzh/gost/cmd/gost