Create a Simple Download Server on a Storage VPS with Aria2 and Nginx
Setting up a file server doesn’t require heavy web panels or complicated apps. The most efficient way is to use Nginx and Aria2 to deploy a download server on storage VPS environment.
In this guide, you will learn a complete setup for your Storage VPS. By combining Nginx’s native directory indexing for serving files with Aria2’s powerful RPC capabilities for fetching them remotely, you can build a fast and resource-friendly download station that consumes almost no system overhead.
Table of Contents
Install Required Packages to Deploy Download Server on Storage VPS
To follow this guide, you need a Storage VPS, which you can check PerLod Hosting plans for reliable plans.
Once you are logged into your server, the first step is to update your system and install the required packages, including Nginx and Aria2:
sudo apt update && sudo apt upgrade -y
sudo apt install nginx aria2 -y
Nginx will be used to serve files, and Aria2 to download them.
Set up the Download Directory
At this point, you need a dedicated place to store all your downloaded files. You can create a new folder and set the correct permissions so Nginx can publicly serve whatever Aria2 downloads into it. To do this, run the commands below:
sudo mkdir -p /var/www/downloads
sudo chown -R www-data:www-data /var/www/downloads
sudo chmod -R 755 /var/www/downloads
Configure Nginx File Index for Download Server
Now you must configure Nginx to display a clean directory listing instead of looking for a default web page. You can set Nginx to serve your download folder and enable file indexing, so every completed Aria2 download displays instantly at your server URL.
Create a new Nginx configuration file with your desired text editor:
sudo nano /etc/nginx/sites-available/downloads
Paste the following configuration into the file with your actual VPS IP or domain:
server {
listen 80;
server_name your_server_ip;
root /var/www/downloads;
location / {
autoindex on;
autoindex_exact_size off;
autoindex_localtime on;
charset utf-8;
}
}
autoindex on;: Enables the directory listing module.autoindex_exact_size off;: Displays file sizes in a readable format, such as KB, MB, and GB instead of exact bytes.autoindex_localtime on;: Shows file timestamps in your server’s local time zone.
Enable the configuration, remove the default config file, and restart Nginx to apply the changes:
sudo ln -s /etc/nginx/sites-available/downloads /etc/nginx/sites-enabled/
sudo rm /etc/nginx/sites-enabled/default
sudo systemctl restart nginx
Configure Aria2 in RPC Mode
Aria2 needs to run as a background service (RPC mode) so you can send download links to it remotely. You can run Aria2 as the www-data user so Nginx can easily read the downloaded files without any permission errors.
Create the configuration directory and session file with the commands below:
sudo mkdir -p /etc/aria2
sudo touch /etc/aria2/aria2.session
sudo chown -R www-data:www-data /etc/aria2
Note: Aria2 session file creates an empty file that Aria2 uses to save download progress. If the server reboots, unfinished downloads will resume.
Create the Aria2 configuration file with your desired text editor:
sudo nano /etc/aria2/aria2.conf
Paste the following configuration into the file:
dir=/var/www/downloads
enable-rpc=true
rpc-listen-all=true
rpc-listen-port=6800
rpc-secret=YOUR_SECURE_TOKEN_HERE
continue=true
input-file=/etc/aria2/aria2.session
save-session=/etc/aria2/aria2.session
save-session-interval=60
max-concurrent-downloads=5
This configuration sets up Aria2 as a remote-controlled service that saves up to 5 simultaneous downloads directly to your Nginx folder, protects access with a secure password, and automatically resumes any interrupted files if your server reboots.
Create a Systemd Service File for Aria2
To ensure Aria2 starts automatically when your VPS boots, you can create a systemd unit file for it. To do this, you can run the command below:
sudo nano /etc/systemd/system/aria2.service
Add the following configuration to the file:
[Unit]
Description=Aria2c RPC Service
After=network.target
[Service]
Type=simple
User=www-data
Group=www-data
ExecStart=/usr/bin/aria2c --conf-path=/etc/aria2/aria2.conf
Restart=on-failure
[Install]
WantedBy=multi-user.target
Once you are done, reload systemd, enable, and start the Aria2 service:
sudo systemctl daemon-reload
sudo systemctl enable aria2
sudo systemctl start aria2
Test Download Server on Storage VPS
At this point, you can test your setup by opening your web browser and visiting the following URL:
http://your_server_ip
You must see an empty Index of / page.
Your server is now actively listening on port 6800. You can connect to it using any Aria2 WebUI like AriaNg or a browser extension by entering your server IP, port 6800, and the rpc-secret token you defined in the previous steps.
When a download finishes in Aria2, you will immediately see it on your server’s web page.
FAQs
How do I access and manage my downloads with Aria2?
You can connect to your server using any Aria2 web interface, such as AriaNg. Open AriaNg in your browser, go to the RPC settings, enter your server’s IP address, set the port to 6800, and paste the rpc-secret password you created.
Why do my files show permission errors when I try to download them from Nginx?
This happens when Aria2 downloads a file as the root user, but Nginx is trying to read it as the www-data user. By running the Aria2 systemd service under User=www-data, both programs share the same permissions.
How do I restart Aria2 if my downloads get stuck?
Since Aria2 runs as a system service, you can easily use: sudo systemctl restart aria2. And because you enabled the save-session feature in the configuration, your unfinished downloads will safely resume after the restart.
Conclusion
At this point, you have a download server on Storage VPS by using Nginx as a simple file indexer and Aria2 for fetching files directly into your download folder. If you want an easier workflow, you can manage everything from your browser by connecting an Aria2 WebUI like AriaNg to your server’s RPC endpoint.
We hope you enjoy using this guide. Subscribe to our X and Facebook channels to get the latest updates and articles.
For further reading: