Note: AriaNg
is considered the best Web
front-end panel for Aira2
by the author. It supports connection using Http(s)
or Websocket(Security)
protocols. If we access the AriaNg
panel using an https
domain, it will force the use of Https
and Websocket
(Secure) protocols. The earlier versions of the panel did not have this requirement, but it is recommended to use the latest version. In order to use Https
and Websocket
(Secure) protocols for connection, we need to configure a certificate for Aria2
. Here are the steps:
Method#
1. Apply for an SSL certificate
Note: If the server where Aria2 is installed already has an existing HTTPS site, you can skip this step and directly use the domain of that site.
First, point a domain to the server where Aria2
is installed, and then apply for an SSL
certificate using the following methods:
1. Baota panel: Website -> Add Website -> Website Settings -> SSL -> Apply Let's Encrypt.
2. LNMP installation package: When adding a domain using the command, there is an option to apply for SSL.
If the server only has Aria2
installed or does not have a Web
environment, you can use Caddy
to apply for the certificate using the following command:
# Install Caddy
curl https://getcaddy.com bash -s personal
# Apply for SSL, replace the domain and email with your own
caddy -host www.moeyy.cn -email [email protected] -agree
Note that for CentOS
systems, you need to open port 80
or else the certificate issuance using Caddy
will fail. To open the port, use the following commands:
# CentOS 6
iptables -I INPUT -p tcp --dport 80 -j ACCEPT
service iptables save
service iptables restart
# CentOS 7
firewall-cmd --zone=public --add-port=80/tcp --permanent
firewall-cmd --reload
The path to the successfully applied SSL
certificate is as follows:
# Replace with your own domain
/root/.caddy/acme/acme-v02.api.letsencrypt.org/sites/www.moeyy.cn
Here, you will find the crt
and key
certificate files for the domain.
2. Modify the configuration file
Edit the Aria2
configuration file aria2.conf
. If you don't know the path, you can use the following command to search for it:
find / -name aria2.conf
Make the following modifications:
# Enable SSL/TLS encryption for RPC service
rpc-secure=true
# Path to the applied domain's crt certificate file, modify accordingly
rpc-certificate=/home/www.moeyy.cn.crt
# Path to the applied domain's key certificate file, modify accordingly
rpc-private-key=/home/www.moeyy.cn.key
If the configuration file does not have the above parameters, you can manually add them. After making the modifications, restart Aria2
for the changes to take effect. Now, both Https
and Websocket
(Secure) protocols can be used. When configuring the RPC
information in AriaNg
, simply enter the domain and the secret key.