Maybe behind a proxy?
Thank you @eris
I read and tried all the solutions and suggestions, unfortunately none solved the problem.
I have this issue on two VPSs running Ubuntu 22.04.4 LTS on Hetzner Cloud. They have been running for many years and have undergone kernel upgrades over time.
In the end, I manually copied nginx-keyring.gpg from another freshly installed VPS.
On Debian 10 and 11 this helped:
apt-get update
apt install curl gnupg2 ca-certificates lsb-release debian-archive-keyring
curl https://nginx.org/keys/nginx_signing.key | gpg --dearmor | tee /usr/share/keyrings/nginx-archive-keyring.gpg >/dev/null
echo "deb [signed-by=/usr/share/keyrings/nginx-archive-keyring.gpg] http://nginx.org/packages/debian `lsb_release -cs` nginx" | tee /etc/apt/sources.list.d/nginx.list
Actually, I took this procedure from nginx official page: nginx: Linux packages
It works. Thanks @sahsanu
This work for me, debian 11
Thanks ! It worked for me on debian 12
None of these solutions worked for me. For me, appeared to be a problem with nginx.gpg in the trusted.gpg.d folder. I don’t have much experience with Linux, but used chatgpt to help me out.
The solution was to create backup of nginx.gpg to nginx.gpg.bak. Then delete original using rm nginx.gpg. After that, I ran apt-get update. Was successful this time. After successful update, I ran the following:
curl -fsSL https://nginx.org/keys/nginx_signing.key | gpg --dearmor -o /etc/apt/trusted.gpg.d/nginx.gpg
This re-added new nginx.gpg into the trusted.gpg.d folder. I then ran apt-get update again, and now it runs no problem.
Seems the old nginx.gpg was base64-encoded. I guess it didn’t like that. The new one copied from nginx.org is unreadable binary data.
Anyways, I have no idea but this resolved my issue and seems everything is running as normal. Apt-get update and apt-get upgrade are working now without any errors.
Muchas gracias! Me funciono la segunda opcion.