Sometimes you need a self-signed certificate for your website that is valid for a longer time. This is pretty easy to do in PowerShell. Use the command below and replace the -Subject parameter (<site_name)> with the name of your site.
New-SelfSignedCertificate -Subject <site_name> -CertStoreLocation Cert:\LocalMachine\My -DnsName "localhost" -NotAfter (Get-Date).AddYears(10) -KeyUsage DigitalSignature
In this example the certificate is valid for 10 years. See the AddYears(10)
part. Modify this to your liking.