├── app ├── healthcheck.sh ├── nopassword.conf ├── default.conf ├── random.conf ├── updatebttracker.sh └── run.sh ├── LICENSE ├── Dockerfile ├── .github └── workflows │ └── dockerimage.yml ├── ReadMe.MD ├── conf └── aria2.conf └── .gitignore /app/healthcheck.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | if [[ `curl -I -m 10 -o /dev/null -s -w %{http_code} localhost:6800` -ne "000" ]] && \ 4 | [[ `curl -I -m 10 -o /dev/null -s -w %{http_code} localhost:${HTTP_PORT}` -ne "000" ]] 5 | then 6 | exit 0 7 | else 8 | exit 1 9 | fi -------------------------------------------------------------------------------- /app/nopassword.conf: -------------------------------------------------------------------------------- 1 | server { 2 | listen 80 default_server; 3 | server_name _; 4 | 5 | # ARIA2 6 | location /jsonrpc { 7 | proxy_pass http://localhost:6800/jsonrpc; 8 | proxy_redirect off; 9 | proxy_set_header X-Real-IP $remote_addr; 10 | proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; 11 | proxy_set_header Host $host; 12 | } 13 | 14 | location / { 15 | root /usr/share/nginx/html; 16 | index index.html index.htm; 17 | } 18 | } -------------------------------------------------------------------------------- /app/default.conf: -------------------------------------------------------------------------------- 1 | server { 2 | listen 80 default_server; 3 | server_name _; 4 | 5 | # ARIA2 6 | location /jsonrpc { 7 | proxy_pass http://localhost:6800/jsonrpc; 8 | proxy_redirect off; 9 | proxy_set_header X-Real-IP $remote_addr; 10 | proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; 11 | proxy_set_header Host $host; 12 | } 13 | 14 | location / { 15 | auth_basic "Please input password"; 16 | auth_basic_user_file /etc/nginx/passwd; 17 | 18 | root /usr/share/nginx/html; 19 | index index.html index.htm; 20 | } 21 | } -------------------------------------------------------------------------------- /app/random.conf: -------------------------------------------------------------------------------- 1 | server { 2 | listen 80 default_server; 3 | server_name _; 4 | 5 | auth_basic "Please input password"; 6 | auth_basic_user_file /etc/nginx/passwd; 7 | 8 | # ARIA2 9 | location /jsonrpc { 10 | if ($cookie_web != "webcookiemask") { 11 | return 401; 12 | } 13 | 14 | # auth_basic "Please input password"; 15 | # auth_basic_user_file /etc/nginx/passwd; 16 | 17 | proxy_pass http://localhost:6800/jsonrpc; 18 | proxy_redirect off; 19 | proxy_set_header X-Real-IP $remote_addr; 20 | proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; 21 | proxy_set_header Host $host; 22 | 23 | add_header Set-Cookie "web=webcookiemask;Max-Age=600"; 24 | } 25 | 26 | location / { 27 | 28 | root /usr/share/nginx/html; 29 | index index.html index.htm; 30 | 31 | add_header Set-Cookie "web=webcookiemask;Max-Age=600"; 32 | } 33 | } -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2019 司徒玟琅 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /app/updatebttracker.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | list=$(curl -s $TRACKER_URL) 4 | if [ -z "${list}" ] 5 | then 6 | echo Failed to update bt trackers. 7 | date > /app/lastupdatefailed.txt 8 | exit 1; 9 | fi 10 | 11 | url_list=$(echo ${list} | sed 's/[ ][ ]*/,/g') 12 | ARIA2_TOKEN=`grep -Eo "^rpc-secret=.*" /conf/aria2.conf | cut -d '=' -f 2` 13 | 14 | # pack json 15 | uuid=$(cat /proc/sys/kernel/random/uuid) 16 | json='{ 17 | "jsonrpc": "2.0", 18 | "method": "aria2.changeGlobalOption", 19 | "id": "'${uuid}'", 20 | "params": [ 21 | "token:'${ARIA2_TOKEN}'", 22 | { 23 | "bt-tracker": "'${url_list}'" 24 | } 25 | ] 26 | }' 27 | 28 | # post json 29 | curl -H "Accept: application/json" \ 30 | -H "Content-type: application/json" \ 31 | -X POST \ 32 | -d "$json" \ 33 | -s "http://localhost:6800/jsonrpc" 34 | 35 | if [ -z `grep "bt-tracker" /conf/aria2.conf` ] 36 | then 37 | sed -i '$a bt-tracker='"${url_list}" /conf/aria2.conf 38 | echo Succeed to add bt trackers. 39 | else 40 | sed -i 's@bt-tracker.*@bt-tracker='"${url_list}"'@g' /conf/aria2.conf 41 | echo Succeed to update bt trackers. 42 | fi 43 | date > /app/lastupdatesuccess.txt -------------------------------------------------------------------------------- /Dockerfile: -------------------------------------------------------------------------------- 1 | FROM alpine:3 2 | 3 | LABEL maintainer="sanjusss sanjusss@qq.com" 4 | 5 | ENV HTTP_PORT=80 6 | ENV EXTERNAL_PORT=80 7 | ENV USER_NAME=admin 8 | ENV PASSWORD=admin 9 | ENV PUID=1000 10 | ENV PGID=1000 11 | ENV TRACKER_URL=https://cdn.jsdelivr.net/gh/ngosang/trackerslist/trackers_all.txt 12 | ENV ENABLE_UPDATE_TRACKER=true 13 | ENV ENABLE_AUTO_RANDOM_ARIA=false 14 | ENV ENABLE_AUTO_CLEAR_ARIANG=true 15 | ENV ENABLE_PASSWORD=true 16 | ENV TZ= 17 | 18 | VOLUME /data 19 | VOLUME /conf 20 | 21 | EXPOSE 80 22 | 23 | WORKDIR /app 24 | ADD app /app 25 | RUN chmod +x /app/*.sh 26 | ADD conf /app/conf 27 | RUN echo '*/15 * * * * /app/updatebttracker.sh' > /etc/crontabs/root 28 | CMD /app/run.sh 29 | HEALTHCHECK --interval=5s --timeout=3s --start-period=5s --retries=3 CMD /app/healthcheck.sh 30 | #RUN sed -i 's/dl-cdn.alpinelinux.org/mirrors.aliyun.com/g' /etc/apk/repositories 31 | 32 | RUN apk add --no-cache \ 33 | aria2 \ 34 | wget \ 35 | apache2-utils \ 36 | sudo \ 37 | nginx \ 38 | curl \ 39 | tzdata \ 40 | shadow 41 | 42 | RUN groupadd -o -g 1000 aria2 \ 43 | && useradd -o -g 1000 -u 1000 aria2 44 | 45 | RUN ARIAGN_VERSION=`curl --silent "https://api.github.com/repos/mayswind/AriaNg/releases/latest" | grep '"tag_name":' | sed -E 's/.*"([^"]+)".*/\1/'` \ 46 | && mkdir -p /run/nginx \ 47 | && mkdir -p /usr/share/nginx/html \ 48 | && rm -rf /usr/share/nginx/html/* \ 49 | && wget -N --no-check-certificate https://github.com/mayswind/AriaNg/releases/download/${ARIAGN_VERSION}/AriaNg-${ARIAGN_VERSION}.zip \ 50 | && unzip AriaNg-${ARIAGN_VERSION}.zip -d /usr/share/nginx/html \ 51 | && rm -rf AriaNg-${ARIAGN_VERSION}.zip \ 52 | && echo Set disable_coredump false >> /etc/sudo.conf 53 | 54 | RUN apk del \ 55 | wget 56 | -------------------------------------------------------------------------------- /.github/workflows/dockerimage.yml: -------------------------------------------------------------------------------- 1 | name: Docker Image CI 2 | 3 | on: 4 | pull_request: 5 | branches: 'master' 6 | paths: 7 | - "**" 8 | - "!**.MD" 9 | - "!LICENSE" 10 | - "!.gitignore" 11 | push: 12 | branches: 'master' 13 | tags: 'v*' 14 | paths: 15 | - "**" 16 | - "!**.MD" 17 | - "!LICENSE" 18 | - "!.gitignore" 19 | 20 | jobs: 21 | buildx: 22 | runs-on: ubuntu-latest 23 | steps: 24 | - 25 | name: Checkout 26 | uses: actions/checkout@v1 27 | - 28 | name: Set up Docker Buildx 29 | id: buildx 30 | uses: crazy-max/ghaction-docker-buildx@v1 31 | with: 32 | version: latest 33 | - 34 | name: Available platforms 35 | run: echo ${{ steps.buildx.outputs.platforms }} 36 | - 37 | name: Prepare 38 | id: prepare 39 | run: | 40 | if [[ $GITHUB_REF == refs/tags/* ]]; then 41 | echo ::set-output name=version::${GITHUB_REF#refs/tags/v} 42 | else 43 | echo ::set-output name=version::snapshot 44 | fi 45 | echo ::set-output name=docker_platforms::linux/amd64,linux/arm/v6,linux/arm/v7,linux/arm64,linux/386,linux/ppc64le,linux/s390x 46 | echo ::set-output name=docker_image::sanjusss/${{ github.event.repository.name }} 47 | - 48 | name: Docker Buildx (no push) 49 | run: | 50 | docker buildx build --platform ${{ steps.prepare.outputs.docker_platforms }} \ 51 | --output "type=image,push=false" \ 52 | --tag "${{ steps.prepare.outputs.docker_image }}:latest" \ 53 | --tag "${{ steps.prepare.outputs.docker_image }}:${{ steps.prepare.outputs.version }}" \ 54 | --file Dockerfile . 55 | - 56 | name: Docker Hub Login 57 | if: success() && !startsWith(github.event_name, 'pull_request') 58 | run: | 59 | docker login --username "${{ secrets.DOCKER_HUB_USER }}" -p ${{ secrets.DOCKER_HUB_PASS }} 60 | - 61 | name: Docker Buildx (push) 62 | if: success() && !startsWith(github.event_name, 'pull_request') 63 | run: | 64 | docker buildx build --platform ${{ steps.prepare.outputs.docker_platforms }} \ 65 | --output "type=image,push=true" \ 66 | --tag "${{ steps.prepare.outputs.docker_image }}:${{ steps.prepare.outputs.version }}" \ 67 | --tag "${{ steps.prepare.outputs.docker_image }}:latest" \ 68 | --file Dockerfile . 69 | - 70 | name: Docker Check Manifest 71 | if: always() && !startsWith(github.event_name, 'pull_request') 72 | run: | 73 | docker run --rm mplatform/mquery ${{ steps.prepare.outputs.docker_image }}:${{ steps.prepare.outputs.version }} 74 | - 75 | name: Clear 76 | if: always() && !startsWith(github.event_name, 'pull_request') 77 | run: | 78 | rm -f ${HOME}/.docker/config.json 79 | -------------------------------------------------------------------------------- /ReadMe.MD: -------------------------------------------------------------------------------- 1 | 2 | [![GitHub](https://img.shields.io/github/license/sanjusss/aria2-ariang-docker)](https://github.com/sanjusss/aria2-ariang-docker/blob/master/LICENSE) 3 | [![Docker Pulls](https://img.shields.io/docker/pulls/sanjusss/aria2-ariang-docker)](https://hub.docker.com/r/sanjusss/aria2-ariang-docker) 4 | [![GitHub tag (latest by date)](https://img.shields.io/github/v/tag/sanjusss/aria2-ariang-docker)](https://github.com/sanjusss/aria2-ariang-docker/tags) 5 | [![GitHub Workflow Status](https://img.shields.io/github/workflow/status/sanjusss/aria2-ariang-docker/Docker%20Image%20CI)](https://github.com/sanjusss/aria2-ariang-docker/actions) 6 | 7 | # 仓库地址 8 | Docker Hub https://hub.docker.com/r/sanjusss/aria2-ariang-docker 9 | Github https://github.com/sanjusss/aria2-ariang-docker 10 | 11 | # 简介 12 | 本镜像打包了Aria2、AriaNg,支持密码验证,无需手动设置aria2 rpc。支持设置AriaNg为任意端口。可以设置自动更新BT Tracker。自动保存aria2进度。支持基于uid、gid的文件权限设置。 13 | 本镜像支持的平台/CPU架构有: 14 | - linux/amd64 15 | - linux/arm/v6 16 | - linux/arm/v7 17 | - linux/arm64 18 | - linux/386 19 | - linux/ppc64le 20 | - linux/s390x 21 | 22 | 如果还需要文件浏览器或Webdav,可以自行安装FileRun、NextCloud或FileBrowser。如果需要打包Aria2、AriaNg、文件浏览器为一个容器,请查看[https://github.com/wahyd4/aria2-ariang-docker](https://github.com/wahyd4/aria2-ariang-docker)。 23 | 24 | # 快速启动 25 | ```shell 26 | docker run -d --name aria2 -p 80:80 -v ./data:/data sanjusss/aria2-ariang-docker 27 | ``` 28 | 访问服务器IP即可进入AriaNg界面,默认用户密码均为admin。 29 | 30 | # 参数 31 | 可以直接参考[Dockerfile](https://github.com/sanjusss/aria2-ariang-docker/blob/master/Dockerfile)。 32 | 33 | ## 环境变量 34 | | 环境变量名称 | 注释 | 默认值 | 35 | | :---- | :----- | :--- | 36 | | HTTP_PORT | 容器内部使用的AriaNg端口,一般不需要修改。 | 80 | 37 | | EXTERNAL_PORT | 最终浏览器访问AriaNg使用的端口,例如通过`https://wtf.com`访问AriaNg,应设置EXTERNAL_PORT值为443。 | 80 | 38 | | USER_NAME | 用户名。 | admin | 39 | | PASSWORD | 密码。 | admin | 40 | | PUID | 下载、生成文件使用的linux uid,如果想使用root请设置为0。 | 1000 | 41 | | PGID | 下载、生成文件使用的linux gid,如果想使用root请设置为0。 | 1000 | 42 | | TRACKER_URL | 更新BT Tracker的网址,一般不需要修改。 | [在线trackers_all.txt](https://cdn.jsdelivr.net/gh/ngosang/trackerslist/trackers_all.txt) | 43 | | ENABLE_UPDATE_TRACKER | 是否定时自动更新BT Tracker的网址。 | true | 44 | | ENABLE_AUTO_RANDOM_ARIA | 每次重启容器时是否自动切换RPCJSON的路径和密码,如果开启此设置,只能在隐私模式下访问ariang,正常模式下浏览会出问题。 | false | 45 | | ENABLE_AUTO_CLEAR_ARIANG | 是否自动清理ARIA NG设置缓存。 | true | 46 | | ENABLE_PASSWORD | 是否设置ARIA NG密码,设置为false时,用户名和密码无效。如果设置了ENABLE_AUTO_RANDOM_ARIA,此选项无效,强制使用密码。 | true | 47 | | TZ | 容器内部使用的时区。设置成`Asia/shanghai`可以使用北京时间。 | 空 | 48 | 49 | ## 挂载路径 50 | | 容器路径 | 注释 | 51 | | :---- | :----- | 52 | | /data | aria2的默认下载路径,必须挂载。 | 53 | | /conf | aria2的默认设置路径,如果需要保存进度记录,请挂载此项。 | 54 | 55 | # Docker-Compose示例 56 | docker-compose.yml文件 57 | ```yml 58 | version: '3' 59 | services: 60 | aria2: 61 | image: sanjusss/aria2-ariang-docker 62 | container_name: aria2 63 | restart: always 64 | environment: 65 | PUID: 1000 66 | PGID: 1000 67 | EXTERNAL_PORT: 80 68 | USER_NAME: user 69 | PASSWORD: 123456 70 | volumes: 71 | - ./conf:/conf 72 | - /data:/data 73 | - /etc/localtime:/etc/localtime:ro 74 | ports: 75 | - 80:80 76 | ``` 77 | 78 | # 示例 79 | 假设我需要在5003端口开启服务,下载路径为/home/data,aria2设置保存到/home/aria2,登录用户为user,密码为123456,UID/GID为1000。 80 | 81 | ## 命令行启动 82 | ```shell 83 | docker run -d --name aria2 \ 84 | -p 5003:80 \ 85 | -v /home/data:/data \ 86 | -v /home/aria2:/conf \ 87 | -e PUID=1000 \ 88 | -e PGID=1000 \ 89 | -e EXTERNAL_PORT=5003 \ 90 | -e USER_NAME=user \ 91 | -e PASSWORD=123456 \ 92 | sanjusss/aria2-ariang-docker 93 | ``` 94 | 95 | ## Docker-Compose启动 96 | docker-compose.yml文件 97 | ```yml 98 | version: '3' 99 | services: 100 | aria2: 101 | image: sanjusss/aria2-ariang-docker 102 | container_name: aria2 103 | environment: 104 | PUID: 1000 105 | PGID: 1000 106 | EXTERNAL_PORT: 5003 107 | USER_NAME: user 108 | PASSWORD: 123456 109 | volumes: 110 | - /home/aria2:/conf 111 | - /home/data:/data 112 | ports: 113 | - 5003:80 114 | ``` 115 | 116 | # 常见问题 117 | ## 重启/重建容器后,进入AriaNg界面,无法自动连接到服务器。 118 | 先刷新页面看能否正常连接,然后连按2次`Ctrl + F5`/`Ctrl + R`强制刷新(有的时候需要按更多次),即可解决。 119 | 最方便的方法是使用隐私模式/无痕模式访问。 120 | -------------------------------------------------------------------------------- /app/run.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # 设置时区 4 | if [ -n ${TZ} ] 5 | then 6 | ln -snf /usr/share/zoneinfo/${TZ} /etc/localtime && echo ${TZ} > /etc/timezone 7 | fi 8 | 9 | # 创建密码 10 | htpasswd -bc /etc/nginx/passwd ${USER_NAME} ${PASSWORD} 11 | 12 | # 初始化aria2配置 13 | if [ ! -f /conf/aria2.session ] 14 | then 15 | touch /conf/aria2.session 16 | fi 17 | 18 | if [ ! -f /conf/aria2.conf ] 19 | then 20 | cp /app/conf/aria2.conf /conf/aria2.conf 21 | fi 22 | 23 | if [ ${ENABLE_AUTO_RANDOM_ARIA} == "true" ] 24 | then 25 | cp -f /app/random.conf /etc/nginx/conf.d/default.conf 26 | # 随机化jsonrcp路径 27 | if [ -f oldRpcPath.txt ] 28 | then 29 | OLD_RPC_PATH=`cat oldRpcPath.txt` 30 | else 31 | OLD_RPC_PATH="jsonrpc" 32 | fi 33 | RPC_PATH=`cat /proc/sys/kernel/random/uuid` 34 | sed -i 's/location \/'"${OLD_RPC_PATH}"'/location \/'"${RPC_PATH}"'/g' /etc/nginx/conf.d/default.conf 35 | sed -i 's/\"'"${OLD_RPC_PATH}"'\"/\"'"${RPC_PATH}"'\"/g' /usr/share/nginx/html/js/aria-ng*.js 36 | echo ${RPC_PATH} > oldRpcPath.txt 37 | 38 | # 随机化aria2密钥 39 | OLD_ARIA2_TOKEN=`grep "^rpc-secret=" /conf/aria2.conf` 40 | ARIA2_TOKEN=`cat /proc/sys/kernel/random/uuid` 41 | if [ -z "${OLD_ARIA2_TOKEN}" ] 42 | then 43 | sed -i '$a rpc-secret='"${ARIA2_TOKEN}" /conf/aria2.conf 44 | else 45 | sed -i 's/'"${OLD_ARIA2_TOKEN}"'/rpc-secret='"${ARIA2_TOKEN}"'/g' /conf/aria2.conf 46 | fi 47 | BASE64_ARIA2_TOKEN=`echo -n ${ARIA2_TOKEN} | base64` 48 | sed -i 's/secret:\"[^\"]*\",/secret:\"'"${BASE64_ARIA2_TOKEN}"'\",/g' /usr/share/nginx/html/js/aria-ng*.js 49 | 50 | # 修改aria-ng*.js路径,强制重新加载文件。 51 | OLD_ARIA_NG_JS=`ls /usr/share/nginx/html/js/aria-ng*.js` 52 | OLD_ARIA_NG_JS_FILE=${OLD_ARIA_NG_JS##*/} 53 | ARIA_NG_JS="/usr/share/nginx/html/js/aria-ng"`cat /proc/sys/kernel/random/uuid`".js" 54 | ARIA_NG_JS_FILE=${ARIA_NG_JS##*/} 55 | mv "${OLD_ARIA_NG_JS}" "${ARIA_NG_JS}" 56 | sed -i 's/'"${OLD_ARIA_NG_JS_FILE}"'/'"${ARIA_NG_JS_FILE}"'/g' /usr/share/nginx/html/*.* 57 | 58 | # 随机化cookie 59 | if [ -f oldCookie.txt ] 60 | then 61 | OLD_COOKIE=`cat oldCookie.txt` 62 | else 63 | OLD_COOKIE="webcookiemask" 64 | fi 65 | COOKIE=`cat /proc/sys/kernel/random/uuid` 66 | sed -i 's/'"${OLD_COOKIE}"'/'"${COOKIE}"'/g' /etc/nginx/conf.d/default.conf 67 | echo ${COOKIE} > oldCookie.txt 68 | else 69 | if [ ${ENABLE_PASSWORD} == "true" ] 70 | then 71 | cp -f /app/default.conf /etc/nginx/conf.d/default.conf 72 | else 73 | cp -f /app/nopassword.conf /etc/nginx/conf.d/default.conf 74 | fi 75 | 76 | # 设置ARIA2密钥 77 | OLD_ARIA2_TOKEN=`grep -Eo "^rpc-secret=.*" /conf/aria2.conf | cut -d '=' -f 2` 78 | if [[ -z "${OLD_ARIA2_TOKEN}" ]] 79 | then 80 | ARIA2_TOKEN=`cat /proc/sys/kernel/random/uuid` 81 | sed -i '$a rpc-secret='"${ARIA2_TOKEN}" /conf/aria2.conf 82 | else 83 | ARIA2_TOKEN=${OLD_ARIA2_TOKEN} 84 | fi 85 | 86 | BASE64_ARIA2_TOKEN=`echo -n ${ARIA2_TOKEN} | base64` 87 | sed -i 's/secret:\"[^\"]*\",/secret:\"'"${BASE64_ARIA2_TOKEN}"'\",/g' /usr/share/nginx/html/js/aria-ng*.js 88 | fi 89 | 90 | # 修改AriaNg,每次启动时都重新设置页面。 91 | if [ ${ENABLE_AUTO_CLEAR_ARIANG} == "true" ] 92 | then 93 | sed -i 's/body class/body onload="localStorage.clear();" class/g' /usr/share/nginx/html/index.html 94 | else 95 | sed -i 's/body onload="localStorage.clear();" class/body class/g' /usr/share/nginx/html/index.html 96 | fi 97 | 98 | # 修改端口号,考虑到重启容器的情况。 99 | if [ -f oldHttpPort.txt ] 100 | then 101 | OLD_HTTP_PORT=`cat oldHttpPort.txt` 102 | else 103 | OLD_HTTP_PORT=80 104 | fi 105 | sed -i 's/'"${OLD_HTTP_PORT}"'/'"${HTTP_PORT}"'/g' /etc/nginx/conf.d/default.conf 106 | echo ${HTTP_PORT} > oldHttpPort.txt 107 | 108 | if [ -f oldExternalPort.txt ] 109 | then 110 | OLD_EXTERNAL_PORT=`cat oldExternalPort.txt` 111 | else 112 | OLD_EXTERNAL_PORT=6800 113 | fi 114 | sed -i 's/'"${OLD_EXTERNAL_PORT}"'/'"${EXTERNAL_PORT}"'/g' /usr/share/nginx/html/js/aria-ng*.js 115 | echo ${EXTERNAL_PORT} > oldExternalPort.txt 116 | 117 | # 设置文件权限 118 | chown -R ${PUID}:${PGID} /conf 119 | chown -R ${PUID}:${PGID} /data 120 | touch /var/log/aria2.log 121 | chmod 755 /var/log/aria2.log 122 | chown ${PUID}:${PGID} /var/log/aria2.log 123 | 124 | # 设置aria2运行用户 125 | if [ ${PUID} -eq "0" ] 126 | then 127 | USER=root 128 | else 129 | USER=aria2 130 | groupmod -o -g "$PGID" "$USER" 131 | usermod -o -u "$PUID" -g "$PGID" "$USER" 132 | fi 133 | 134 | # 启动nginx 135 | nginx 136 | 137 | # 启动cron,自动更新tracker 138 | if [ ${ENABLE_UPDATE_TRACKER} == "true" ] 139 | then 140 | crond 141 | fi 142 | 143 | # 启动aria2 144 | sudo -u#${PUID} /usr/bin/aria2c --conf-path=/conf/aria2.conf 145 | -------------------------------------------------------------------------------- /conf/aria2.conf: -------------------------------------------------------------------------------- 1 | #用户名 2 | #rpc-user=user 3 | #密码 4 | #rpc-passwd=passwd 5 | #上面的认证方式不建议使用,建议使用下面的token方式 6 | #设置加密的密钥 7 | #rpc-secret=token123456 8 | #允许rpc 9 | enable-rpc=true 10 | #允许所有来源, web界面跨域权限需要 11 | rpc-allow-origin-all=false 12 | #允许外部访问,false的话只监听本地端口 13 | rpc-listen-all=false 14 | #RPC端口, 仅当默认端口被占用时修改 15 | #rpc-listen-port=6800 16 | #最大同时下载数(任务数), 路由建议值: 3 17 | max-concurrent-downloads=5 18 | #断点续传 19 | continue=true 20 | #同服务器连接数 21 | max-connection-per-server=5 22 | #最小文件分片大小, 下载线程数上限取决于能分出多少片, 对于小文件重要 23 | min-split-size=10M 24 | #单文件最大线程数, 路由建议值: 5 25 | split=10 26 | #下载速度限制 27 | max-overall-download-limit=0 28 | #单文件速度限制 29 | max-download-limit=0 30 | #上传速度限制 31 | max-overall-upload-limit=0 32 | #单文件速度限制 33 | max-upload-limit=0 34 | #断开速度过慢的连接 35 | #lowest-speed-limit=0 36 | #验证用,需要1.16.1之后的release版本 37 | #referer=* 38 | #文件保存路径, 默认为当前启动位置 39 | # dir=/user-files/superuser/ 40 | dir=/data 41 | #文件缓存, 使用内置的文件缓存, 如果你不相信Linux内核文件缓存和磁盘内置缓存时使用, 需要1.16及以上版本 42 | #disk-cache=0 43 | #另一种Linux文件缓存方式, 使用前确保您使用的内核支持此选项, 需要1.15及以上版本(?) 44 | #enable-mmap=true 45 | #文件预分配, 能有效降低文件碎片, 提高磁盘性能. 缺点是预分配时间较长 46 | #所需时间 none < falloc ? trunc « prealloc, falloc和trunc需要文件系统和内核支持 47 | file-allocation=prealloc 48 | 49 | # disable IPV6 by default 50 | disable-ipv6=true 51 | 52 | # General Options 53 | log=/var/log/aria2.log 54 | #You can set either debug, info, notice, warn or error. 55 | log-level=notice 56 | 57 | 58 | ## 进度保存相关 ## 59 | # 从会话文件中读取下载任务 60 | input-file=/conf/aria2.session 61 | # 在Aria2退出时保存`错误/未完成`的下载任务到会话文件 62 | save-session=/conf/aria2.session 63 | # 定时保存会话, 0为退出时才保存, 需1.16.1以上版本, 默认:0 64 | save-session-interval=10 65 | 66 | # BT trackers from https://raw.githubusercontent.com/ngosang/trackerslist/master/trackers_all.txt 67 | bt-tracker=udp://tracker.coppersurfer.tk:6969/announce,udp://tracker.leechers-paradise.org:6969/announce,udp://tracker.opentrackr.org:1337/announce,udp://p4p.arenabg.com:1337/announce,udp://9.rarbg.to:2710/announce,udp://9.rarbg.me:2710/announce,udp://tracker.openbittorrent.com:80/announce,udp://exodus.desync.com:6969/announce,udp://retracker.lanta-net.ru:2710/announce,udp://open.stealth.si:80/announce,udp://denis.stalker.upeer.me:6969/announce,udp://tracker.torrent.eu.org:451/announce,udp://tracker.moeking.me:6969/announce,udp://tracker.cyberia.is:6969/announce,udp://ipv4.tracker.harry.lu:80/announce,udp://open.demonii.si:1337/announce,udp://tracker3.itzmx.com:6961/announce,udp://tracker.tiny-vps.com:6969/announce,udp://explodie.org:6969/announce,http://explodie.org:6969/announce,udp://tracker.yoshi210.com:6969/announce,udp://tracker.uw0.xyz:6969/announce,udp://tracker.ds.is:6969/announce,udp://retracker.netbynet.ru:2710/announce,udp://zephir.monocul.us:6969/announce,udp://xxxtor.com:2710/announce,udp://valakas.rollo.dnsabr.com:2710/announce,udp://tracker.zum.bi:6969/announce,udp://tracker.tvunderground.org.ru:3218/announce,udp://tracker.trackton.ga:7070/announce,udp://tracker.sbsub.com:2710/announce,udp://tracker.nyaa.uk:6969/announce,udp://tracker.nextrp.ru:6969/announce,udp://tracker.kamigami.org:2710/announce,udp://tracker.filemail.com:6969/announce,udp://tracker.dler.org:6969/announce,udp://tracker-udp.gbitt.info:80/announce,udp://retracker.akado-ural.ru:80/announce,udp://opentor.org:2710/announce,udp://open.nyap2p.com:6969/announce,udp://bt2.archive.org:6969/announce,udp://bt1.archive.org:6969/announce,udp://bt.okmp3.ru:2710/announce,https://zqzx.xyz:443/announce,https://tracker.nanoha.org:443/announce,https://1337.abcvg.info:443/announce,http://www.proxmox.com:6969/announce,http://tracker.tvunderground.org.ru:3218/announce,http://tracker.opentrackr.org:1337/announce,http://tracker.kamigami.org:2710/announce,http://tracker.corpscorp.online:80/announce,http://tracker.bt4g.com:2095/announce,http://t.nyaatracker.com:80/announce,http://retracker.sevstar.net:2710/announce,http://mail2.zelenaya.net:80/announce,http://h4.trakx.nibba.trade:80/announce,udp://tracker4.itzmx.com:2710/announce,udp://tracker2.itzmx.com:6961/announce,udp://tracker.lelux.fi:6969/announce,udp://tr.bangumi.moe:6969/announce,udp://qg.lorzl.gq:2710/announce,udp://opentracker.i2p.rocks:6969/announce,udp://chihaya.toss.li:9696/announce,udp://bt2.54new.com:8080/announce,https://tracker.parrotlinux.org:443/announce,https://tracker.opentracker.se:443/announce,https://tracker.gbitt.info:443/announce,http://www.loushao.net:8080/announce,http://vps02.net.orel.ru:80/announce,http://tracker4.itzmx.com:2710/announce,http://tracker3.itzmx.com:6961/announce,http://tracker2.itzmx.com:6961/announce,http://tracker1.itzmx.com:8080/announce,http://tracker01.loveapp.com:6789/announce,http://tracker.yoshi210.com:6969/announce,http://tracker.torrentyorg.pl:80/announce,http://tracker.nyap2p.com:8080/announce,http://tracker.lelux.fi:80/announce,http://tracker.gbitt.info:80/announce,http://tracker.bz:80/announce,http://pow7.com:80/announce,http://opentracker.i2p.rocks:6969/announce,http://open.acgtracker.com:1096/announce,http://open.acgnxtracker.com:80/announce 68 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | ## Ignore Visual Studio temporary files, build results, and 2 | ## files generated by popular Visual Studio add-ons. 3 | ## 4 | ## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore 5 | 6 | # User-specific files 7 | *.rsuser 8 | *.suo 9 | *.user 10 | *.userosscache 11 | *.sln.docstates 12 | 13 | # User-specific files (MonoDevelop/Xamarin Studio) 14 | *.userprefs 15 | 16 | # Mono auto generated files 17 | mono_crash.* 18 | 19 | # Build results 20 | [Dd]ebug/ 21 | [Dd]ebugPublic/ 22 | [Rr]elease/ 23 | [Rr]eleases/ 24 | x64/ 25 | x86/ 26 | [Aa][Rr][Mm]/ 27 | [Aa][Rr][Mm]64/ 28 | bld/ 29 | [Bb]in/ 30 | [Oo]bj/ 31 | [Ll]og/ 32 | [Ll]ogs/ 33 | 34 | # Visual Studio 2015/2017 cache/options directory 35 | .vs/ 36 | # Uncomment if you have tasks that create the project's static files in wwwroot 37 | #wwwroot/ 38 | 39 | # Visual Studio 2017 auto generated files 40 | Generated\ Files/ 41 | 42 | # MSTest test Results 43 | [Tt]est[Rr]esult*/ 44 | [Bb]uild[Ll]og.* 45 | 46 | # NUnit 47 | *.VisualState.xml 48 | TestResult.xml 49 | nunit-*.xml 50 | 51 | # Build Results of an ATL Project 52 | [Dd]ebugPS/ 53 | [Rr]eleasePS/ 54 | dlldata.c 55 | 56 | # Benchmark Results 57 | BenchmarkDotNet.Artifacts/ 58 | 59 | # .NET Core 60 | project.lock.json 61 | project.fragment.lock.json 62 | artifacts/ 63 | 64 | # StyleCop 65 | StyleCopReport.xml 66 | 67 | # Files built by Visual Studio 68 | *_i.c 69 | *_p.c 70 | *_h.h 71 | *.ilk 72 | *.meta 73 | *.obj 74 | *.iobj 75 | *.pch 76 | *.pdb 77 | *.ipdb 78 | *.pgc 79 | *.pgd 80 | *.rsp 81 | *.sbr 82 | *.tlb 83 | *.tli 84 | *.tlh 85 | *.tmp 86 | *.tmp_proj 87 | *_wpftmp.csproj 88 | *.log 89 | *.vspscc 90 | *.vssscc 91 | .builds 92 | *.pidb 93 | *.svclog 94 | *.scc 95 | 96 | # Chutzpah Test files 97 | _Chutzpah* 98 | 99 | # Visual C++ cache files 100 | ipch/ 101 | *.aps 102 | *.ncb 103 | *.opendb 104 | *.opensdf 105 | *.sdf 106 | *.cachefile 107 | *.VC.db 108 | *.VC.VC.opendb 109 | 110 | # Visual Studio profiler 111 | *.psess 112 | *.vsp 113 | *.vspx 114 | *.sap 115 | 116 | # Visual Studio Trace Files 117 | *.e2e 118 | 119 | # TFS 2012 Local Workspace 120 | $tf/ 121 | 122 | # Guidance Automation Toolkit 123 | *.gpState 124 | 125 | # ReSharper is a .NET coding add-in 126 | _ReSharper*/ 127 | *.[Rr]e[Ss]harper 128 | *.DotSettings.user 129 | 130 | # TeamCity is a build add-in 131 | _TeamCity* 132 | 133 | # DotCover is a Code Coverage Tool 134 | *.dotCover 135 | 136 | # AxoCover is a Code Coverage Tool 137 | .axoCover/* 138 | !.axoCover/settings.json 139 | 140 | # Visual Studio code coverage results 141 | *.coverage 142 | *.coveragexml 143 | 144 | # NCrunch 145 | _NCrunch_* 146 | .*crunch*.local.xml 147 | nCrunchTemp_* 148 | 149 | # MightyMoose 150 | *.mm.* 151 | AutoTest.Net/ 152 | 153 | # Web workbench (sass) 154 | .sass-cache/ 155 | 156 | # Installshield output folder 157 | [Ee]xpress/ 158 | 159 | # DocProject is a documentation generator add-in 160 | DocProject/buildhelp/ 161 | DocProject/Help/*.HxT 162 | DocProject/Help/*.HxC 163 | DocProject/Help/*.hhc 164 | DocProject/Help/*.hhk 165 | DocProject/Help/*.hhp 166 | DocProject/Help/Html2 167 | DocProject/Help/html 168 | 169 | # Click-Once directory 170 | publish/ 171 | 172 | # Publish Web Output 173 | *.[Pp]ublish.xml 174 | *.azurePubxml 175 | # Note: Comment the next line if you want to checkin your web deploy settings, 176 | # but database connection strings (with potential passwords) will be unencrypted 177 | *.pubxml 178 | *.publishproj 179 | 180 | # Microsoft Azure Web App publish settings. Comment the next line if you want to 181 | # checkin your Azure Web App publish settings, but sensitive information contained 182 | # in these scripts will be unencrypted 183 | PublishScripts/ 184 | 185 | # NuGet Packages 186 | *.nupkg 187 | # NuGet Symbol Packages 188 | *.snupkg 189 | # The packages folder can be ignored because of Package Restore 190 | **/[Pp]ackages/* 191 | # except build/, which is used as an MSBuild target. 192 | !**/[Pp]ackages/build/ 193 | # Uncomment if necessary however generally it will be regenerated when needed 194 | #!**/[Pp]ackages/repositories.config 195 | # NuGet v3's project.json files produces more ignorable files 196 | *.nuget.props 197 | *.nuget.targets 198 | 199 | # Microsoft Azure Build Output 200 | csx/ 201 | *.build.csdef 202 | 203 | # Microsoft Azure Emulator 204 | ecf/ 205 | rcf/ 206 | 207 | # Windows Store app package directories and files 208 | AppPackages/ 209 | BundleArtifacts/ 210 | Package.StoreAssociation.xml 211 | _pkginfo.txt 212 | *.appx 213 | *.appxbundle 214 | *.appxupload 215 | 216 | # Visual Studio cache files 217 | # files ending in .cache can be ignored 218 | *.[Cc]ache 219 | # but keep track of directories ending in .cache 220 | !?*.[Cc]ache/ 221 | 222 | # Others 223 | ClientBin/ 224 | ~$* 225 | *~ 226 | *.dbmdl 227 | *.dbproj.schemaview 228 | *.jfm 229 | *.pfx 230 | *.publishsettings 231 | orleans.codegen.cs 232 | 233 | # Including strong name files can present a security risk 234 | # (https://github.com/github/gitignore/pull/2483#issue-259490424) 235 | #*.snk 236 | 237 | # Since there are multiple workflows, uncomment next line to ignore bower_components 238 | # (https://github.com/github/gitignore/pull/1529#issuecomment-104372622) 239 | #bower_components/ 240 | 241 | # RIA/Silverlight projects 242 | Generated_Code/ 243 | 244 | # Backup & report files from converting an old project file 245 | # to a newer Visual Studio version. Backup files are not needed, 246 | # because we have git ;-) 247 | _UpgradeReport_Files/ 248 | Backup*/ 249 | UpgradeLog*.XML 250 | UpgradeLog*.htm 251 | ServiceFabricBackup/ 252 | *.rptproj.bak 253 | 254 | # SQL Server files 255 | *.mdf 256 | *.ldf 257 | *.ndf 258 | 259 | # Business Intelligence projects 260 | *.rdl.data 261 | *.bim.layout 262 | *.bim_*.settings 263 | *.rptproj.rsuser 264 | *- [Bb]ackup.rdl 265 | *- [Bb]ackup ([0-9]).rdl 266 | *- [Bb]ackup ([0-9][0-9]).rdl 267 | 268 | # Microsoft Fakes 269 | FakesAssemblies/ 270 | 271 | # GhostDoc plugin setting file 272 | *.GhostDoc.xml 273 | 274 | # Node.js Tools for Visual Studio 275 | .ntvs_analysis.dat 276 | node_modules/ 277 | 278 | # Visual Studio 6 build log 279 | *.plg 280 | 281 | # Visual Studio 6 workspace options file 282 | *.opt 283 | 284 | # Visual Studio 6 auto-generated workspace file (contains which files were open etc.) 285 | *.vbw 286 | 287 | # Visual Studio LightSwitch build output 288 | **/*.HTMLClient/GeneratedArtifacts 289 | **/*.DesktopClient/GeneratedArtifacts 290 | **/*.DesktopClient/ModelManifest.xml 291 | **/*.Server/GeneratedArtifacts 292 | **/*.Server/ModelManifest.xml 293 | _Pvt_Extensions 294 | 295 | # Paket dependency manager 296 | .paket/paket.exe 297 | paket-files/ 298 | 299 | # FAKE - F# Make 300 | .fake/ 301 | 302 | # CodeRush personal settings 303 | .cr/personal 304 | 305 | # Python Tools for Visual Studio (PTVS) 306 | __pycache__/ 307 | *.pyc 308 | 309 | # Cake - Uncomment if you are using it 310 | # tools/** 311 | # !tools/packages.config 312 | 313 | # Tabs Studio 314 | *.tss 315 | 316 | # Telerik's JustMock configuration file 317 | *.jmconfig 318 | 319 | # BizTalk build output 320 | *.btp.cs 321 | *.btm.cs 322 | *.odx.cs 323 | *.xsd.cs 324 | 325 | # OpenCover UI analysis results 326 | OpenCover/ 327 | 328 | # Azure Stream Analytics local run output 329 | ASALocalRun/ 330 | 331 | # MSBuild Binary and Structured Log 332 | *.binlog 333 | 334 | # NVidia Nsight GPU debugger configuration file 335 | *.nvuser 336 | 337 | # MFractors (Xamarin productivity tool) working folder 338 | .mfractor/ 339 | 340 | # Local History for Visual Studio 341 | .localhistory/ 342 | 343 | # BeatPulse healthcheck temp database 344 | healthchecksdb 345 | 346 | # Backup folder for Package Reference Convert tool in Visual Studio 2017 347 | MigrationBackup/ 348 | 349 | # Ionide (cross platform F# VS Code tools) working folder 350 | .ionide/ 351 | --------------------------------------------------------------------------------