A certificate downloaded from Windows, a browser or a router is often a binary DER file with a .cer or .crt name. nginx and most Linux tools want the PEM text form.
First see which one you have. PEM is text and starts with -----BEGIN CERTIFICATE-----; DER is binary:
head -c 30 cert.cer; echo
openssl x509 -inform der -in cert.cer -out cert.pem
After the conversion, cert.pem holds the same certificate in base64 between the BEGIN and END lines. The other way works with -outform der:
openssl x509 -in cert.pem -outform der -out cert.der
The file name tells you nothing, which is why I’d check the first bytes before guessing. A .crt can be either format, and a .cer from Windows is usually DER, but not always. If openssl x509 -in file without options fails with Could not find certificate or a PEM error, try -inform der.
This is for a single certificate. Keys have their own command, openssl pkey -inform der. Files with several certificates and a key in one, like .pfx or .p12, are PKCS#12 and need openssl pkcs12. A .p7b bundle is PKCS#7, which openssl pkcs7 -print_certs unpacks.
Further reading: OpenSSL: openssl-x509, OpenSSL: format options
Going deeper: Run degoog on Unraid as your own search page, compared with SearXNG and 4get