mirror of
https://github.com/tteck/Proxmox.git
synced 2025-02-15 06:09:15 +01:00
[Aria2] Use Nginx rather than caddy
This commit is contained in:
parent
613089851a
commit
1f217ea51f
1 changed files with 21 additions and 18 deletions
|
@ -19,7 +19,7 @@ $STD apt-get install -y sudo
|
||||||
$STD apt-get install -y mc
|
$STD apt-get install -y mc
|
||||||
$STD apt-get install -y wget
|
$STD apt-get install -y wget
|
||||||
$STD apt-get install -y unzip
|
$STD apt-get install -y unzip
|
||||||
$STD apt-get install -y caddy
|
$STD apt-get install -y nginx
|
||||||
msg_ok "Installed Dependencies"
|
msg_ok "Installed Dependencies"
|
||||||
|
|
||||||
msg_info "Installing Aria2"
|
msg_info "Installing Aria2"
|
||||||
|
@ -31,22 +31,24 @@ if [[ ${prompt,,} =~ ^(y|yes)$ ]]; then
|
||||||
msg_info "Installing AriaNG"
|
msg_info "Installing AriaNG"
|
||||||
mkdir -p /var/www
|
mkdir -p /var/www
|
||||||
wget -q "$(curl -s https://api.github.com/repos/mayswind/ariang/releases/latest | grep download | grep AllInOne.zip | cut -d\" -f4)" -O /root/ariang.zip
|
wget -q "$(curl -s https://api.github.com/repos/mayswind/ariang/releases/latest | grep download | grep AllInOne.zip | cut -d\" -f4)" -O /root/ariang.zip
|
||||||
ZIP="$(ls -l /root | grep zip$ | awk '{print $9}')"
|
unzip "$(ls -l /root | grep zip$ | awk '{print $9}')" -d /var/www
|
||||||
unzip /root/$ZIP -d /var/www
|
|
||||||
service_path="/etc/systemd/system/ariang.service"
|
service_path="/etc/systemd/system/ariang.service"
|
||||||
echo '[Unit]
|
cat <<EOF >/etc/nginx/conf.d/ariang.conf
|
||||||
Description=AriaNG
|
server {
|
||||||
ConditionFileIsExecutable=/usr/local/bin/caddy
|
listen 80 default_server;
|
||||||
After=network.target
|
listen [::]:80 default_server;
|
||||||
|
|
||||||
[Service]
|
server_name _;
|
||||||
ExecStart=/usr/local/bin/caddy "-root /var/www "browse"
|
|
||||||
Restart=always
|
|
||||||
RestartSec=120
|
|
||||||
|
|
||||||
[Install]
|
root /var/www;
|
||||||
WantedBy=multi-user.target' >$service_path
|
index index.html;
|
||||||
systemctl enable --now -q ariang.service
|
|
||||||
|
location / {
|
||||||
|
try_files $uri $uri/ =404;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
EOF
|
||||||
|
systemctl restart nginx
|
||||||
msg_ok "Installed AriaNG"
|
msg_ok "Installed AriaNG"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
@ -69,8 +71,8 @@ Restart=on-failure
|
||||||
[Install]
|
[Install]
|
||||||
WantedBy=multi-user.target' >$service_path
|
WantedBy=multi-user.target' >$service_path
|
||||||
|
|
||||||
conf_path="/root/aria2.daemon"
|
cat <<EOF >/root/aria2.daemon
|
||||||
echo 'continue
|
continue
|
||||||
dir=/var/www/downloads
|
dir=/var/www/downloads
|
||||||
file-allocation=falloc
|
file-allocation=falloc
|
||||||
max-connection-per-server=4
|
max-connection-per-server=4
|
||||||
|
@ -80,7 +82,8 @@ min-split-size=25M
|
||||||
rpc-allow-origin-all=true
|
rpc-allow-origin-all=true
|
||||||
rpc-secret=YouShouldChangeThis
|
rpc-secret=YouShouldChangeThis
|
||||||
input-file=/var/tmp/aria2c.session
|
input-file=/var/tmp/aria2c.session
|
||||||
save-session=/var/tmp/aria2c.session' >$conf_path
|
save-session=/var/tmp/aria2c.session
|
||||||
|
EOF
|
||||||
systemctl enable --now -q aria2.service
|
systemctl enable --now -q aria2.service
|
||||||
|
|
||||||
msg_ok "Created Service"
|
msg_ok "Created Service"
|
||||||
|
@ -89,7 +92,7 @@ motd_ssh
|
||||||
customize
|
customize
|
||||||
|
|
||||||
msg_info "Cleaning up"
|
msg_info "Cleaning up"
|
||||||
rm /root/$ZIP
|
rm /root/"$(ls -l /root | grep zip$ | awk '{print $9}')"
|
||||||
$STD apt-get autoremove
|
$STD apt-get autoremove
|
||||||
$STD apt-get autoclean
|
$STD apt-get autoclean
|
||||||
msg_ok "Cleaned"
|
msg_ok "Cleaned"
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue