Also, using --standalone implies nothing is listening on port 80.
So, what is there to --redirect ?
That won't fix a missing redirection.
So, you have a cert that covers two names and all you need is for one of those names to redirect.
That means you must not have those two names in one vhost.
One of the names redirects
The other name does not redirect.
Please show the full nginx config, with:
nginx -T
Note: The first server block shown has no server_name entry.
Thank you bro,
the --redirect flag solved the problem,
now there is another issue here,
the server is still listening in the device ip, I want to block all the traffic that is coming to the device Ip address?
But for local webserver configuration, it is absolutely unnecessary to re-issue the certificate? Because it wasn't a certificate issue? Why would you re-issue the certificate without any reason 4 times?
Cert not due for renewal, but simulating renewal for dry run
Plugins selected: Authenticator nginx, Installer nginx
Renewing an existing certificate
Performing the following challenges:
http-01 challenge for arshaddadash.ir
http-01 challenge for www.arshaddadash.ir
Waiting for verification...
Cleaning up challenges
new certificate deployed with reload of nginx server; fullchain is
/etc/letsencrypt/live/arshaddadash.ir/fullchain.pem
** DRY RUN: simulating 'certbot renew' close to cert expiry
** (The test certificates below have not been saved.)
Congratulations, all renewals succeeded. The following certs have been renewed:
/etc/letsencrypt/live/arshaddadash.ir/fullchain.pem (success)
** DRY RUN: simulating 'certbot renew' close to cert expiry
** (The test certificates above have not been saved.)
IMPORTANT NOTES:
Your account credentials have been saved in your Certbot
configuration directory at /etc/letsencrypt. You should make a
secure backup of this folder now. This configuration directory will
also contain certificates and private keys obtained by Certbot so
making regular backups of this folder is ideal.
Because if you mean something like https://IPaddress "works" then yes it will connect.
But, it will be rejected by browsers as the cert won't have a matching name to the URL (which is an IP address).
If you want to catch non-SNI requests in nginx you have to setup a default server block accordingly. You start with using server_name properly which you are not. This isn't the ideal forum to learn about basic nginx config though.