Skip to content

Instantly share code, notes, and snippets.

@maple3142
Last active September 26, 2023 07:38

Revisions

  1. maple3142 revised this gist Oct 2, 2019. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion aria2c.conf
    Original file line number Diff line number Diff line change
    @@ -23,7 +23,7 @@ referer=*
    http-accept-gzip=true
    save-session-interval=60
    force-save=false
    log-level=info
    log-level=notice
    # Log file
    log=/home/user/.aria2.log
    allow-overwrite=true
  2. maple3142 created this gist Oct 2, 2019.
    30 changes: 30 additions & 0 deletions aria2-nginx.conf
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,30 @@
    # Put this file in /etc/nginx/sites-available
    # Then "ln -s /etc/nginx/sites-available/aria2-nginx.conf /etc/nginx/sites-enabled"
    # Then "sudo service nginx restart"
    server {
    listen 80;
    listen [::]:80;
    root /var/www/aria2; # Put your aria2 web ui here, such as AriaNg
    index index.html;
    server_name DOMAIN_NAME;
    location / {
    try_files $uri $uri/ =404;
    }
    location /jsonrpc {
    # Proxy jsonrpc to local aria2c server, since https page can't make "http" and "ws" connection.
    # To connect, simply connect to wss://DOMAIN_NAME:443/jsonrpc
    proxy_pass http://localhost:6800/jsonrpc;
    proxy_redirect off;
    proxy_set_header X-Real-IP $remote_addr;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_set_header Host $host;
    proxy_http_version 1.1;
    proxy_set_header Upgrade $http_upgrade;
    proxy_set_header Connection "upgrade";
    }
    location /files {
    alias /home/USER/downloads; # Aria2c download folder
    autoindex on;
    }
    # Remember to use "sudo certbot --nginx" to enable ssl
    }
    32 changes: 32 additions & 0 deletions aria2c.conf
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,32 @@
    # Secret
    rpc-secret=SECRET
    enable-rpc=true
    # Only allow connection from nginx proxy
    rpc-allow-origin-all=false
    rpc-listen-all=false
    max-concurrent-downloads=5
    continue=true
    max-connection-per-server=16
    min-split-size=10M
    split=10
    max-overall-download-limit=0
    max-download-limit=0
    max-overall-upload-limit=0
    max-upload-limit=0
    # Download destination, should be the same in "/files" block of nginx config
    dir=/home/user/downloads
    # Your session file location, and you shouldn't forget to create it before hand. (Or aria2c will fail to start.)
    input-file=/home/user/.aria2.session
    save-session=/home/user/.aria2.session
    file-allocation=prealloc
    referer=*
    http-accept-gzip=true
    save-session-interval=60
    force-save=false
    log-level=info
    # Log file
    log=/home/user/.aria2.log
    allow-overwrite=true
    # BT seeding configurations, modify it dependes on your needs and server bandwidth
    seed-time=0
    seed-ratio=0
    13 changes: 13 additions & 0 deletions aria2c.service
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,13 @@
    # Put this file in "/etc/systemd/system" to make it a systemd service
    # "sudo service aria2c start" to start
    [Unit]
    Description=Aria2c download manager
    After=network.target

    [Service]
    Type=simple
    User=user # Your username
    ExecStart=/usr/bin/aria2c --conf-path=/home/user/aria2.conf # Modify your configuration location here

    [Install]
    WantedBy=multi-user.target