In general, replace the default source address of Debian http://deb.debian.org/ in the /etc/apt/sources.list file with the mirror address.
Debian Buster onwards supports HTTPS feeds by default. If you encounter a situation where HTTPS feeds cannot be pulled, use HTTP feeds first and install:
However, generally speaking, in order to obtain security updates in a more timely manner, it is not recommended to use mirror sites for security update software sources, because mirror sites often have synchronization delays. refer tohttps://www.debian.org/security/faq.en.html#mirror
The purpose of security.debian.org is to make security updates available as quickly and easily as possible.
Encouraging the use of unofficial mirrors would add extra complexity that is usually not needed and that can cause frustration if these mirrors are not kept up to date.
In apt 2.1.9 and later versions, there seems to be some incompatibility between the HTTP Pipelining feature of apt and the Nginx server, which may cause high-bandwidth downloads of a large number of software packages from mirror sites Occasional Connection reset by peer errors during (e.g. system upgrades) (SeeDebian bug #973581)。
Currently, users can resolve this issue by turning off the HTTP Pipelining feature.
If you need to close it, you can add the -o Acquire::http::Pipeline-Depth=0 parameter when using the apt command,
Or use the following command to add the relevant settings to the apt system configuration:
echo "Acquire::http::Pipeline-Depth \"0\";" > /etc/apt/apt.conf.d/99nopipelining