Requirements
- You should have a stable server that almost never reboots (this will cause active downloads to stop, giving broken downloads to the users)
- With a good bandwidth (recommended at least 1TB / monthly so we don't want you to be overbilled)
- At least 20GB+ of disk space to store them
- An own user for the mirror with ssh access (isos are sent using ssh+rsync to them)
- To NOT use: cloudflare (or similar)
Bandwith usage
In an average good usage, there are around 30 downloads per day between all the mirrors, if we have 6 mirrors this means 4.4 downloads, the isos average size is 3.3 GBResult: (3.3 x 4.4 x 30) means usage of 400 GB per month
Most hostings should provide at least 1 or 2 TB of bandwidth for their cheapest options (vultr = 2TB for 5 usd/month), which should suffice for the need
How to check how many mirrors we actually have: https://www.elivecd.org/downloads/mirrorcheck
Don'ts:
- Do not use CloudFlare
- Don't use a server which reboots from time to time (downloads to the user will be corrupted if they are downloading)
Auto method (nginx only):
We have a special tool to Elivize servers (adding elive features), one of these options is to install an Elive mirror (using nginx) everything in an automated way, if you want to use this tool you can read more about it to know how it works or just run the command:
bash - <(curl -fsSLg -- "https://raw.githubusercontent.com/Elive-Premium/elive-for-servers/main/installer.sh" ) --install=elivemirror-isos
Note: you must be a premium (patreon) user to access to the elive-for-servers feature, but if you want to be a mirror you will of course have access to all the premium features!
Important: we strongly recommend using Apache instead, nginx is an alternative option
Contact Thanatermesis via email if you want to be a mirror so you can have Premium access too
Manual method:
-
Create a user where the isos will be stored and the web link pointed to
-
Create a subdomain to serve the isos, or just a web link, it will require to have autorenewable SSL certificate (httpS), that point to the location of the isos
-
Using Apache: mod_rewrite (AllowOverride All) should be enabled, or using Nginx: "autoindex on" should be enabled
One-shot script to run from the user:
HOSTNAME=\$(hostname) ; yes | ssh-keygen -t rsa -C "\$HOSTNAME" -f "\$HOME/.ssh/id_rsa" -P ""
mkdir -p "$HOME/.ssh"
echo 'ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAk45j0yfCnHcyi6EKy/tnUOfUKMMeVf1rc/nRPratslLwVVr+bCqjS/KVc5si+8yGsCxQzow2TC3hlymvyxVZhA0Q17G87UQb61nLeG9sl45LyPg5gqLYZUoxaxjT/L/T5XkqpfXhXle5ix0metdSh0sZHMnfhRvMXOAkQHY7YBWMkh9TOLu45GiUW2XKDSZjEWV0NeR06r66KspqsV5jR6HCZ9iQDMoya/6HdTqNDqpza+qqAcHvXCWAbAgr95PXDbSM1KIS9KCRebHVka1437kCU3vrwXKBIb0OF0Rnseqs4icTu2xnu74H2/+uM/C+o4f2QFjJM/CwlQ0w2kL2+Q== elivewebsites@zatara' >> "$HOME/.ssh/authorized_keys"
chmod 744 "$HOME/.ssh"
chmod 600 "$HOME/.ssh/authorized_keys"
mkdir -p "$HOME/public_html"
chgrp -R "www-data" "$HOME/public_html" # debian and similar systems uses www-data user for the webserver, make sure that this user is set to the group of the directory recursively
chmod -R 750 "$HOME/public_html"
chmod g+s "$HOME/public_html"
Security:
We didn't had problems with this in the past but I strongly suggest to take measures against bots that could waste our bandwith by making unnecesary downloads, avoid bad IP's, etc
The Elive website actually only gives the download to good reputable IP's (from the abuseipdb database) among many other security checks like validation of email (these, only when the download is in delayed-mode, so asking for the email and waiting X time) etc... so you are already protected, in any case I suggest you to implement some extra security code in your server like this one (suggestions for this wiki welcome!) which will not allow more than 8 requests per IP in a time of 10 minutes:
Apache conf limit
<IfModule mod_ratelimit.c>
<Location "/">
# Enable rate limiting
SetOutputFilter RATE_LIMIT
# Limit to 8 requests per 600 seconds (10 minutes) per file per IP
RateLimitInterval 600
RateLimitByte 8
# Return 429 Too Many Requests when the limit is exceeded
ErrorDocument 429 "Too Many Requests - You have exceeded the request limit for this file."
</Location>
</IfModule>
Nginx conf limit
This is an example of the limit_req_zone configuration:http {
limit_req_zone $binary_remote_addr zone=file_limits:10m rate=8r/m;
server {
listen 80;
server_name example.com;
location / {
# Apply rate limiting to file requests
limit_req zone=file_limits burst=12 nodelay;
limit_req_status 429; # Return 429 Too Many Requests
# Your usual proxy_pass or root directive
root /var/www/html;
}
error_page 429 /429.html;
location = /429.html {
internal;
return 429 "Too Many Requests - You have exceeded the request limit for this file.";
}
}
}
Caddle / Caddy conf limit
This is an example of a global conf (for all files):rate_limit {
zone global_limits {
key {http.request.remote.host}
rate 8/10m
}
}
Or, a more specific conf:
example.com {
# Rate limit per file per IP (8 requests/10 min)
@limited path=/*
handle @limited {
rate_limit {
zone file_limits {
key {http.request.remote.host}_{http.request.uri.path}
rate 8/10m
burst 5 # Optional: allow small bursts
}
}
respond 429 "Too Many Requests - You've exceeded the rate limit for this file."
}
# Your normal file server or reverse proxy
root * /var/www/html
file_server
}
- Finally, send an email to Thanatermesis 4t gmail with: The web link for the isos, the username and the directory on which is located the isos (~/public_html/ probably), the city/country where is located the mirror, your email in case a contact is needed.